Operating System MCA BPUT Unit-2
Operating System MCA BPUT Unit-2
1. Process Management
o Process is a program in execution --- numerous processes to choose
from in a multiprogrammed system,
o Process creation/deletion (bookkeeping)
o Process suspension/resumption (scheduling, system vs. user)
o Process synchronization
o Process communication
o Deadlock handling
2. Memory Management
4. File System
o File creation/deletion.
o Support for hierarchical file systems
o Update/retrieval operations: read, write, append, seek
o Mapping of files to secondary storage
5. Protection
1|Page
Contact: 7008443534, 9090042626
Subject: Operating System
Created By: Asst. Prof. SK ABDUL ISRAR College: ABA, BLS
6. Network Management
8. User Interface
2|Page
Contact: 7008443534, 9090042626
Subject: Operating System
Created By: Asst. Prof. SK ABDUL ISRAR College: ABA, BLS
Simple structure:
Such operating systems do not have well defined structure and are small, simple
and limited systems. The interfaces and levels of functionality are not well
separated. MS-DOS is an example of such operating system. In MS-DOS
application programs are able to access the basic I/O routines. These types of
operating system cause the entire system to crash if one of the user programs
fails.
Diagram of the structure of MS-DOS is shown below.
Layered structure:
An OS can be broken into pieces and retain much more control on system. In this
structure the OS is broken into number of layers (levels). The bottom layer (layer
0) is the hardware and the topmost layer (layer N) is the user interface. These
layers are so designed that each layer uses the functions of the lower level layers
only. This simplifies the debugging process as if lower level layers are debugged
and an error occurs during debugging then the error must be on that layer only
as the lower level layers have already been debugged.
The main disadvantage of this structure is that at each layer, the data needs to be
modified and passed on which adds overhead to the system. Moreover careful
planning of the layers is necessary as a layer can use only lower level layers.
UNIX is an example of this structure.
3|Page
Contact: 7008443534, 9090042626
Subject: Operating System
Created By: Asst. Prof. SK ABDUL ISRAR College: ABA, BLS
Micro-kernel:
This structure designs the operating system by removing all non-essential
components from the kernel and implementing them as system and user
programs. This result in a smaller kernel called the micro-kernel.
Advantages of this structure are that all new services need to be added to user
space and does not require the kernel to be modified. Thus it is more secure and
reliable as if a service fails then rest of the operating system remains untouched.
Mac OS is an example of this type of OS.
4|Page
Contact: 7008443534, 9090042626
Subject: Operating System
Created By: Asst. Prof. SK ABDUL ISRAR College: ABA, BLS
System Calls
System calls provide an interface to the services made available by an OS.
These calls are generally available as routines written in C and C++, although
certain low-level tasks may need to be written using assembly language
instruction.
5|Page
Contact: 7008443534, 9090042626
Subject: Operating System
Created By: Asst. Prof. SK ABDUL ISRAR College: ABA, BLS
System Programs
System program provide a convenient environment for program development
and execution. Some of them are simply user interfaces to system calls. Others
are considerably more complex.
They can be divided into these categories:
1. File management
These programs create, delete, copy, rename, print, list and generally
manipulate files and directories.
2. Status information
Some programs simply ask for the system for the date, time, amount of
available memory or disk space, number of users, or similar status
information.
3. File modification
Several text editors may be available to create and modify the content of
files stored on disk or other storage devices.
6. Communications
These programs provide the mechanism for creating virtual connections
among processes, users and computer systems. They allow users to send
messages to one another’s screen, to browse webpages, to send e-mail
messages to login remotely, onto transfer file from one machine to
another.
7|Page
Contact: 7008443534, 9090042626
Subject: Operating System
Created By: Asst. Prof. SK ABDUL ISRAR College: ABA, BLS
Process
A process is basically a program in execution. The execution of a process
must progress in a sequential fashion.
A process is defined as an entity which represents the basic unit of work
to be implemented in the system.
To put it in simple terms, we write our computer programs in a text file
and when we execute this program, it becomes a process which performs
all the tasks mentioned in the program.
When a program is loaded into the memory and it becomes a process, it
can be divided into four sections ─ stack, heap, text and data. The
following image shows a simplified layout of a process inside main
memory –
8|Page
Contact: 7008443534, 9090042626
Subject: Operating System
Created By: Asst. Prof. SK ABDUL ISRAR College: ABA, BLS
1 Stack
The process Stack contains the temporary data such as method/function
parameters, return address and local variables.
2 Heap
This is dynamically allocated memory to a process during its run time.
3 Text
This includes the current activity represented by the value of Program
Counter and the contents of the processor's registers.
4 Data
This section contains the global and static variables.
9|Page
Contact: 7008443534, 9090042626
Subject: Operating System
Created By: Asst. Prof. SK ABDUL ISRAR College: ABA, BLS
10 | P a g e
Contact: 7008443534, 9090042626
Subject: Operating System
Created By: Asst. Prof. SK ABDUL ISRAR College: ABA, BLS
Process State
11 | P a g e
Contact: 7008443534, 9090042626
Subject: Operating System
Created By: Asst. Prof. SK ABDUL ISRAR College: ABA, BLS
The process, from its creation to completion, passes through various states. The
minimum number of states is five.
The names of the states are not standardized although the process may be in
one of the following states during execution.
1. New
A program which is going to be picked up by the OS into the main memory is
called a new process.
2. Ready
Whenever a process is created, it directly enters in the ready state, in which, it
waits for the CPU to be assigned. The OS picks the new processes from the
secondary memory and put all of them in the main memory.
The processes which are ready for the execution and reside in the main memory
are called ready state processes. There can be many processes present in the
ready state.
3. Running
One of the processes from the ready state will be chosen by the OS depending
upon the scheduling algorithm. Hence, if we have only one CPU in our system,
the number of running processes for a particular time will always be one. If we
have n processors in the system then we can have n processes running
simultaneously.
4. Block or wait
From the Running state, a process can make the transition to the block or wait
state depending upon the scheduling algorithm or the intrinsic behavior of the
process.
When a process waits for a certain resource to be assigned or for the input from
the user then the OS move this process to the block or wait state and assigns
the CPU to the other processes.
5. Completion or termination
When a process finishes its execution, it comes in the termination state. All the
context of the process (Process Control Block) will also be deleted the process
will be terminated by the Operating system.
12 | P a g e
Contact: 7008443534, 9090042626
Subject: Operating System
Created By: Asst. Prof. SK ABDUL ISRAR College: ABA, BLS
6. Suspend ready
A process in the ready state, which is moved to secondary memory from the
main memory due to lack of the resources (mainly primary memory) is called in
the suspend ready state.
If the main memory is full and a higher priority process comes for the execution
then the OS have to make the room for the process in the main memory by
throwing the lower priority process out into the secondary memory. The suspend
ready processes remain in the secondary memory until the main memory gets
available.
7. Suspend wait
Instead of removing the process from the ready queue, it's better to remove the
blocked process which is waiting for some resources in the main memory. Since
it is already waiting for some resource to get available hence it is better if it
waits in the secondary memory and make room for the higher priority process.
These processes complete their execution once the main memory gets available
and their wait is finished.
2. Scheduling
Out of the many processes present in the ready queue, the Operating system
chooses one process and start executing it. Selecting the process which is to be
executed next, is known as scheduling.
3. Execution
Once the process is scheduled for the execution, the processor starts executing
it. Process may come to the blocked or wait state during the execution then in
that case the processor starts executing the other processes.
4. Deletion/killing
Once the purpose of the process gets over then the OS will kill the process. The
Context of the process (PCB) will be deleted and the process gets terminated by
the Operating system.
13 | P a g e
Contact: 7008443534, 9090042626
Subject: Operating System
Created By: Asst. Prof. SK ABDUL ISRAR College: ABA, BLS
14 | P a g e
Contact: 7008443534, 9090042626