Managing the Processes and Controlling the access.

Riya DeshmukhRiya Deshmukh
5 min read

Hello everyone!!

I am back with my new exciting blog from the blog series...

This is the sixth blog of the series regarding the Linux workshop organized by Pranav Jambare sir.

Contents:

  1. Booting Process

  2. Access Contol List

  3. Processes

Booting Processes:

There are six states in the Booting process.

Booting Process in Operating System

  1. BIOS:
  • BIOS stands for basic input /output System. In simple terms, the BIOS loads and executes the Master Boot Record (MBR) boot loader.

  • It performs a power-On-Self-Test to check if all hardware components are working correctly.

  1. MBR:
  • MBR stands for Master Boot Record.

  • MBR is a small section of the hard drive's first sector that contains essential boot information.

  • OS Master Boot Record - javatpoint

  • it includes the 446 bootloaders 64 partition table 2 magic, such as LILO and GRUB, which helps start the operating system during the booting process.

  1. GRUB :
  • GRUB stands for Grand Unified Bootloader.

  • GRUB 1 - we can get the code point to another level.

  • GRUB 1.5- Allow the file system to communicate with the hardware

  • GRUB 2- Responsible for loading of kernal.

  1. Kernal:
  • Kernal is the heart of the operating system, responsible for initializing and managing hardware, memory, and processes.

  • it uncompresses itself and mounts it.

  • it creates a root device and mounts it into the read-only memory.

  • it freezes the unused memory.

  • it is also responsible for initializing virtual devices into the system.

  1. Init.d/system d:
  • The first process of Linux is known as init.d.

  • it mounts the file system i.e./etc/fsab.

  • it identifies the default target.

  • it initializes the services.

  1. Run level:
  • it is a specific mode or state in which a computer's operating system starts up.

  •     #syntax
        who -r
        #this command is used to display the current run level of linux system during the booting process
    
#syntax 
systemctl set default multi-user.target
#this command is used to confugure the default run level.
#syntax
systemctl get-default
#this command is used to retrieve the default target.

Modes are:

  1. 0 - halt state/poweroff.target.

  2. 1 - Single user mode/rescue. target.

  3. 2 - Multiuser mode without networking.

  4. 3 - multiuser mode with networking.

  5. 4 - user definable.

  6. 5 - GUI graphical target.

  7. 6 - Reboot target.

ACL:

  • ACL stands for Acess Control List.

  • ACL provides access control to directories and files.

  • PDF] POSIX Access Control Lists on Linux | Semantic Scholar

  • ACL can set read, write, and execute permissions for the owner, group, and all system users.

  • An ACL consists of a set of rules that specify how a specific user or group can access ACL-enabled files and directories.

  • ACL is used for controlling permissions to a computer system or computer network.

  • ACL can be set with the following command:

  •   #syntax 
      setfacl -m u:<username>:<permission> <directoryname>
      #example
      setfacl -m u:riya:rwx /tmp/testACL
    

    The following command is used for viewing ACLs on a file or directory.

  •   #syntax
      getfacl <filename/directoryname>
      #example
      getfacl sampleACL
    

    To remove ACLs, we use the following command:

#syntax
setfacl -x u:<username>: <filename>
# example
setfacl -x u:testuser:rwx sampleACL

Processes:

  • Processes in Linux are essential components of the operating system that execute programs and manage system resources.

  • Each process operates independently, having its memory space, execution context, and system resources.

There are five states of process in Linux:

  1. Created

  2. Ready

  3. Running

  4. Waiting

  5. Terminate

Types of the process:

  • Parent process: A parent process is a process that creates another process (called the child process). It typically initiates the child's process to perform a specific task or execute a particular program.

  • Child process: A child process is created by a parent process and inherits some of its attributes and resources.

  • Orphan process: An orphan process is a child process whose parent process has terminated before it did.

  • Zombie process: A zombie process is a terminated child process that has completed its task, but its exit status is still needed by its parent. Although it no longer executes, it remains in the process table until the parent retrieves its exit status.

Some process-related commands:

To kill the process:

#syntax
kill -9 <pid>
#Example
kill -9 3132

To resume the Process:

#syntax
kill -18 <pid>
#Example
kill -18 3132

To terminate the process:

#syntax
kill -15 <pid>
#Example
kill -15 3132

To suspend the process:

#syntax
kill -19 <pid>
#Example
kill -19 3132

To check stopped processes:

#syntatical example
jobs
#general output
[1] + Done       pwd

To run the process in the background:

#syntax
bg %<job number>
#Example
bg %1

To show Running Process:

#syntax
top

Fields of top command:

PID - Process ID

USER - User who initiated a particular process

PR - Priority

NI - NIC value

VIRT - Virtual memory

RES - Reserved memory

SHR S - Shared memory

%CPU - CPU uses

%MEM - Memory uses

TIME + - total CPU time

COMMAND- command line(name+options)

  • To start a new process by assigning the priority:

  •   #syntax
      mice <-nice value>
    

The nice value ranges from -20 to 19 where the -20 is highest priority and 19 is the lowest priority.

  • To change the priority of an already running process :

  •   #syntax
      renice <-nice value> <pid>
    

    Thank you for reading my blog.....

23
Subscribe to my newsletter

Read articles from Riya Deshmukh directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Riya Deshmukh
Riya Deshmukh