0% found this document useful (0 votes)
253 views14 pages

Operating System MCA BPUT Unit-2

The document discusses the components and structures of operating systems. It describes 7 key components of operating systems: process management, memory management, I/O device management, file systems, protection, network management, and user interfaces. It then discusses 4 common structures: simple, layered, micro-kernel, and modular. Finally, it covers system calls and common system programs.

Uploaded by

danger boy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
253 views14 pages

Operating System MCA BPUT Unit-2

The document discusses the components and structures of operating systems. It describes 7 key components of operating systems: process management, memory management, I/O device management, file systems, protection, network management, and user interfaces. It then discusses 4 common structures: simple, layered, micro-kernel, and modular. Finally, it covers system calls and common system programs.

Uploaded by

danger boy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Subject: Operating System

Created By: Asst. Prof. SK ABDUL ISRAR College: ABA, BLS

Operating System Components


From the virtual machine point of view (also resource management)

These components reflect the services made available by the O.S.

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

o Maintain bookkeeping information


o Map processes to memory locations
o Allocate/deallocate memory space as requested/required

3. I/O Device Management

o Disk management functions such as free space management,


storage allocation, fragmentation removal, head scheduling
o Consistent, convenient software to I/O device interface through
buffering/caching, custom drivers for each device.

4. File System

Built on top of disk management

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

Controlling access to the system

1|Page
Contact: 7008443534, 9090042626
Subject: Operating System
Created By: Asst. Prof. SK ABDUL ISRAR College: ABA, BLS

o Resources --- CPU cycles, memory, files, devices


o Users --- authentication, communication
o Mechanisms, not policies

6. Network Management

Often built on top of file system

o TCP/IP, IPX, IPng


o Connection/Routing strategies
o ``Circuit'' management --- circuit, message, packet switching
o Communication mechanism
o Data/Process migration

7. Network Services (Distributed Computing)


Built on top of networking

o Email, messaging (GroupWise)


o FTP
o gopher, www
o Distributed file systems --- NFS, AFS, LAN Manager
o Name service --- DNS, YP, NIS
o Replication --- gossip, ISIS
o Security --- kerberos

8. User Interface

o Character-Oriented shell --- sh, csh, command.com ( User replaceable)


o GUI --- X, Windows 95

Different approaches or Structures of


Operating Systems
Operating system can be implemented with the help of various structures. The
structure of the OS depends mainly on how the various common components of
the operating system are interconnected and melded into the kernel. Depending
on this we have following structures of the operating system:

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.

Modular structure or approach:


It is considered as the best approach for an OS. It involves designing of a modular
kernel. The kernel has only set of core components and other services are added
as dynamically loadable modules to the kernel either during run time or boot
time. It resembles layered structure due to the fact that each kernel has defined
and protected interfaces but it is more flexible than the layered structure as a
module can call any other module.
For example Solaris OS is organized as shown in the figure.

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.

How system calls are used?


Writing a simple program to read data from one file and copy them to another
file. The first input that the program will need is the names of the two files: the
input file and the output file.
By using an interactive program, the user can ask the name of the two files.
This approach requires a sequence of system calls, first to write a prompting
message on the screen and then to read from the keyboard the characters
define the two files.
Once the two files names are obtained the program must open the input file
and create the output file. Each of these operations requires system call.
If the input file already exists, is missing or is protected against access then a
system call is generated to print a message for abnormal termination.
If the output file already exists then a system call is generated, we may delete
or replace the existing file to store the new one.

5|Page
Contact: 7008443534, 9090042626
Subject: Operating System
Created By: Asst. Prof. SK ABDUL ISRAR College: ABA, BLS

Types of system calls


System calls can be grouped roughly into 5 major categories:
• Process control
• File manipulation
• Device management
• Information maintenance
• Communication
❖ Process Control
➢ End, abort
➢ Load, execute
➢ Create process, terminate process
➢ Get process attributes, set process attributes
➢ Wait for time
➢ Wait event, signal event
➢ Allocate and free memory
❖ File manipulation
➢ Create file, delete file
➢ Open, close
➢ Read, write, reposition
➢ Get file attributes, set file attributes
❖ Device management
➢ Request device, release device
➢ Read, write, reposition
➢ Get device attributes, set device attributes
➢ Logically attach or detach devices
❖ Information maintenance
➢ Get system time, set system time
➢ Get system date, set system date
➢ Get process, file or device attributes
➢ Set process, file or device attributes
❖ Communication
➢ Create, delete communication connection
➢ Send, receive message
➢ Transfer status information
➢ Attach or detach remote devices
6|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.

4. Programming language support


Compilers, assemblers, debuggers and interpreters for common program
language (such as C, C++, Java, Visual Basic and PERL) are often provided
to the user with the OS.

5. Program loading and execution


Once a program is assembled or compiled, it must be loaded into
memory to be executed.

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

S.N. Component & Description

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.

Process Control Block


Process Control Block is a data structure that contains information of the
process related to it. The process control block is also known as a task
control block, entry of the process table, etc.
It is very important for process management as the data structuring for
processes is done in terms of the PCB. It also defines the current state of
the operating system.
Structure of the Process Control Block
The process control stores many data items that are needed for efficient
process management. Some of these data items are explained with the
help of the given diagram –

9|Page
Contact: 7008443534, 9090042626
Subject: Operating System
Created By: Asst. Prof. SK ABDUL ISRAR College: ABA, BLS

The following are the data items −


Process State
This specifies the process state i.e. new, ready, running, waiting or
terminated.
Process Number
This shows the number of the particular process.
Program Counter
This contains the address of the next instruction that needs to be executed
in the process.
Registers
This specifies the registers that are used by the process. They may
include accumulators, index registers, stack pointers, general purpose
registers etc.
List of Open Files
These are the different files that are associated with the process
CPU Scheduling Information
The process priority, pointers to scheduling queues etc. is the CPU
scheduling information that is contained in the PCB. This may also include
any other scheduling parameters.

10 | P a g e
Contact: 7008443534, 9090042626
Subject: Operating System
Created By: Asst. Prof. SK ABDUL ISRAR College: ABA, BLS

Memory Management Information


The memory management information includes the page tables or the
segment tables depending on the memory system used. It also contains
the value of the base registers, limit registers etc.
I/O Status Information
This information includes the list of I/O devices used by the process, the
list of files etc.
Accounting information
The time limits, account numbers, amount of CPU used, process numbers
etc. are all a part of the PCB accounting information.
Location of the Process Control Block
The process control block is kept in a memory area that is protected from
the normal user access. This is done because it contains important
process information. Some of the operating systems place the PCB at the
beginning of the kernel stack for the process as it is a safe location.

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.

Operations on the Process


1. Creation
Once the process is created, it will be ready and come into the ready queue
(main memory) and will be ready for the execution.

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

How a process differs from a program

• Process is an executing part of a program whereas a program


is a group of ordered operations to achieve a programming
goal.
• The process has a shorter and minimal lifespan whereas
program has a longer lifespan.
• Process contains many resources like a memory address, disk,
printer while Program needs memory space on the disk to
store all instructions.
• Process is a dynamic or active entity whereas Program is a
passive or static entity.
• Process has considerable overhead whereas Program has no
significant overhead cost.

14 | P a g e
Contact: 7008443534, 9090042626

You might also like