Bootstrap and Process Management

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Operating System Functions

Bootstrap process
A bootstrap program is the first code that is executed when the computer system is started. The entire
operating system depends on the bootstrap program to work correctly as it loads the operating system.

In the above image, the bootstrap program is a part of ROM which is the non-volatile memory. The operating
system is loaded into the RAM by the bootstrap program after the start of the computer system. Then the
operating system starts the device drivers.

Bootstrapping Process
The bootstrapping process does not require any outside input to start. Any software can be loaded as
required by the operating system rather than loading all the software automatically.

The bootstrapping process is performed as a chain i.e. at each stage, it is the responsibility of the simpler
and smaller program to load and execute the much more complicated and larger program. This means that
the computer system improves in increments by itself.

The booting procedure starts with the hardware procedures and then continues onto the software procedures
that are stored in the main memory. The bootstrapping process involves self-tests, loading BIOS,
configuration settings, hypervisor, operating system etc.

Benefits of Bootstrapping
Without bootstrapping, the computer user would have to download all the software components, including
the ones not frequently required. With bootstrapping, only those software components need to be
downloaded that are legitimately required and all extraneous components are not required. This process
frees up a lot of space in the memory and consequently saves a lot of time.
Process Management

A process is the execution of a program that performs the actions specified in that program. It can be
defined as an execution unit where a program runs. The OS helps you to create, schedule, and terminates
the processes which is used by CPU. A process created by the main process is called a child process.

Process operations can be easily controlled with the help of PCB(Process Control Block). You can consider
it as the brain of the process, which contains all the crucial information related to processing like process
id, priority, state, CPU registers, etc.

What is Process Management?

Process management involves various tasks like creation, scheduling, termination of processes, and a
dead lock. Process is a program that is under execution, which is an important part of modern-day
operating systems. The OS must allocate resources that enable processes to share and exchange
information. It also protects the resources of each process from other methods and allows synchronization
among processes.

Process Control Blocks

The PCB is a full form of Process Control Block. It is a data structure that is maintained by the Operating
System for every process. The PCB should be identified by an integer Process ID (PID). It helps you to
store all the information required to keep track of all the running processes.

It is also accountable for storing the contents of processor registers. These are saved when the process
moves from the running state and then returns back to it. The information is quickly updated in the PCB
by the OS as soon as the process makes the state transition.

Process States

A process state is a condition of the process at a specific instant of time. It also defines the current
position of the process.
There are mainly seven stages of a process which are:

• New: The new process is created when a specific program calls from secondary memory/ hard disk
to primary memory/ RAM a
• Ready: In a ready state, the process should be loaded into the primary memory, which is ready for
execution.
• Waiting: The process is waiting for the allocation of CPU time and other resources for execution.
• Executing/Running: The process is an execution state.
• Blocked: It is a time interval when a process is waiting for an event like I/O operations to
complete.
• Suspended: Suspended state defines the time when a process is ready for execution but has not
been placed in the ready queue by OS.
• Terminated: Terminated state specifies the time when a process is terminated

After completing every step, all the resources are used by a process, and memory becomes free.

Process Control Block(PCB)

Every process is represented in the operating system by a process control block, which is also called a
task control block.

• Process state: A process can be new, ready, running, waiting, etc.


• Program counter: The program counter lets you know the address of the next instruction, which
should be executed for that process.
• CPU registers: This component includes accumulators, index and general-purpose registers, and
information of condition code.
• CPU scheduling information: This component includes a process priority, pointers for scheduling
queues, and various other scheduling parameters.
• Accounting and business information: It includes the amount of CPU and time utilities like real
time used, job or process numbers, etc.
• Memory-management information: This information includes the value of the base and limit
registers, the page, or segment tables. This depends on the memory system, which is used by the
operating system.
• I/O status information: This block includes a list of open files, the list of I/O devices that are
allocated to the process, etc.

The Interrupt Mechanism

An interrupt is an event that alters the sequence in which the processor executes instructions.

An interrupt might be planned (specifically requested by the currently running program) or unplanned
(caused by an event that might or might not be related to the currently running program). z/OS® uses six
types of interrupts, as follows:

I/O interrupts
These interrupts occur when the channel subsystem signals a change of status, such as an
input/output (I/O) operation completing, an error occurring, or an I/O device such as a printer has
become ready for work.
External interrupts
These interrupts can indicate any of several events, such as a time interval expiring, the operator
pressing the interrupt key on the console, or the processor receiving a signal from another
processor.
Restart interrupts
These interrupts occur when the operator selects the restart function at the console or when a
restart SIGP (signal processor) instruction is received from another processor.
Program interrupts caused by a running process
These interrupts are caused by program errors (for example, the program attempts to perform an
invalid operation), page faults (the program references a page that is not in central storage), or
requests to monitor an event.
Machine check interrupts
These interrupts are caused by machine malfunctions.

How the interrupt mechanism works

A key point towards understanding how operating systems work is to understand what the CPU does when
an interrupt occurs. The hardware of the CPU does the exact same thing for each interrupt, which is what
allows operating systems to take control away from the current running user process. The switching of
running processes to execute code from the OS kernel is called a context switch.

CPUs rely on the data contained in a couple registers to correctly handle interrupts. One register holds a
pointer to the process control block of the current running process. This register is set each time a process
is loaded into memory. The other register holds a pointer to a table containing pointers to the instructions
in the OS kernel for interrupt handlers and system calls. The value in this register and contents of the table
are set when the operating system is initialized at boot time.

The CPU performs the following actions in response to an interrupt:

1. Using the pointer to the current process control block, the state and all register values for the process
are saved for use when the process is later restarted.
2. The CPU mode bit is switched to supervisory mode.
3. Using the pointer to the interrupt handler table and the interrupt vector, the location of the kernel
code to execute is determined. The interrupt vector is the IRQ for hardware interrupts (read from an
interrupt controller register) and an argument to the interrupt assembly language instruction for
software interrupts.
4. Processing is switched to the appropriate portion of the kernel.

NOTE: The kernel is a computer program at the core of a computer's operating system that has complete
control over everything in the system. It is the "portion of the operating system code that is always
resident in memory” and facilitates interactions between hardware and software components.

You might also like