0% found this document useful (0 votes)
20 views24 pages

Os - 2

Uploaded by

Shravani Salunke
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)
20 views24 pages

Os - 2

Uploaded by

Shravani Salunke
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/ 24

CHAPTER

Operating
2 Systemn Structure

Syllabus
System components : Process managenent, Main memory
management, File nanagement, Input/output systern
management, Secondary storage management, Operating
systen services, System calls : Uses, process control. file
management, Device management, Information maintenance,
communication, Operating system structure, Simple structure,
layered, monolithic, micro kernel, Booting.

Statistical Analysis

BTE Paper Marks allotted for


this chapter
Winter 2008 20Marks
Surnmer 2009 24 Marks
Winter 2009 16Marks
Surmmer 2010 24 Marks
Winter 2010 18Marks
The

Operating Systern(MSBTE) 23 Operating Sren a


Operating Bystem (MSBTE) Operating System Structure speed is very fast
at s time, In short #witching
2-2

2.1 Operating System Structure sharing O8.


the users the responss t
To provide quiek access to short. This is
State and oxplain six major components of system, W.-08 should be reSOnable or very
system shoiA
Draw neat diagram and explain operating systerm structure important feature which operating system shoul
computer
S10 provide to ita users. Even the
gives the feel that CPU
Describe two systom components in detail. W10 be more active because it
Important aspect of an operating system executes many jobs at a time.
nultiprogramming. Generally a single user cannot Operating Systarm
keep CPU as well input/output devices busy. This
ultimately reduces the CPU as well as I/O device
utilization.
Multiprogramming is a technigue used tominimize the job 2
CPUutilization where the work is divided into jobs and job 3
this way CPU and other devices are kept busy by
assigning jobs to them one by one. job 4
The jobs are kept in the memory and then operating 1024M
system executes them one by one. Jobs may have to Fig. 2.1 : Memory layouts for multi- programned system
zait for input/Output devices and CPU. Then according
to the availability of devices job waits. During this Time sharing and multiprogramming needs to make
the job queue in the main memory. Sinee the snain
phase an operating system switches to other johb. eg. if memory is very less to keep all the jobs, the job pools
operating system executes jobl and if I/O devices are are created on the disk
free, an operating system executes job 2 which may use
I/O devices. Till that time job1 makes CPU ree and The job pool is consist of all processes residing on disk
CPU is assigned to job2. This way operating system awaiting allocation of main memory and if there is not
manages the resources as well as jobs by switching Hufficient space for them then main memory elhooses
technique the job among the m. Then OS does job scheduling
There is another concept called as time sharing which using dfferent techniques and after that CPU
scheduling is done
is logicalextension of multiprogramming. Time sharing
time sharing
1n The time shring operating system must nsure
is also called as multitasking
executes multiple jobs But the reasonable response time which is achieved usng a
operating system CPU
switching time among the different jobs is too less that
technique called as swapping In swapping, processes
re aw apped in and out of memory Lo the disk
ISer do not understand that CPU cxecutes only one job
Operating Systerm Structure
AOperatig Systern(MSATE) Operating SystemStnicture
2-4
Operating System(MSBTE) 2-5

(b) Each user has at least one program


There is another technique called aa "Virtual memory" executing in memory.
which allows the execution of process that is not (c) If severaljobs ready to run at the same time
completely in memory. The benefit of virtual memory is the CPUscheduling is done.
that this technique allows user to run program whose
size is more than physical memory. (d) Ifprocesses don't fit in memory, swapping
moves them in and out to run.
Time sharing system even provides a file system File (e) Virtual memory allows execution of
system is collection fle related utilities present on the
processes not completely in memory but
disk File system is present on the disks and needs disk using the space occupied on the secondary
management. Time sharing 0S should ensure
memory.
Mechanism for protecting resources from
inappropriate use. System components are described as
a. List system components. S-10
Mechanism for job synchronization and
communication. Enlist _ystem components. Describe any two in details.
W-10
3 Check that job should not be stuck due to
deadlock. 1. Process management
In short : 2. Main menory management
a) Multiprogramming 1S mainly needed for 3. File management
efficieney. 4. I/0 system management
b Single user cannot keep CPU and VO devices 5. Secondary storage management.
busy at all times.
Multiprogramming organizes jobs (code and data) 6. Networking
in such a way that CPU always has at least one 7. Protection System
job to execute. 8. Command Interpreter
A subset of total jobs in system is kept in emory.
tel One job selected and run vin job scheduling. 2.1.1 Process Management
When it has to wait (for O for example), 0s Q. What is a process ? How is it different from a program ?
switches to another job S-09
Timesharing (multitasking) lagical What is process management ? State four functions to be
extenston of multiprogramming in which CPU pertormed by OS for process managernent W-09, W-10
switches jobs so frequently that users can nteract The task executed bv the CPUis referred as a proeess
with each job while it is running, It creates It couldbe aprogram execution which gets execute or it
interactive conputing INIrOIment. could he internal system tasks executed by CPU
Response time should be c1 second
hCeomn

P Operating System(MSBTE) 2-6 Operating System Structure


Operating Systern (MSBTE)2-7 Operating System Stru
The operating system manages many kinds of activities (c) A mechanism for process synchronizatie
ranging from user programs to system programs Iike Process synchronization is very important
printer spooler, name servers, file server ete. Each of synchronization ensures the coordination
these activities is called as process. which runs at
different process time
While executing a program, different resources are Synchronization is required when one process
required e.g.: input/output devices, data, program, may give some input to other process and then
menory etc. So obviously these resources becomes the execution of second process proceeds.
part of process. e.g.: If we execute a program where we (d) A mechanism for process communication:
need to find out different information related to a fle Processes may need to communicate with each
then an input required is name of the file. So process other to ensure its full execution,and smooth
even deals with input and output through programs. running of multiple processes by using different
In short a process requires input includes the complete resources at a time.

execution components like code, data, PC(program (e) A mechanism for deadlock handling: When
counter), registers, OS resources in use etc. multiple processes runs at a time and does wait
Important thing to remember is that a process is not a for each other, a deadlock situation occurs. OS
handles deadlocks.
program. A process is only ONE instant or moment of a
program in execution. For exampBe a formula execution 2.1.2 Main-Memory Management
i.e. calculation in a program could be a process.
Process is unit, which measures the work done What are the different responsibilities af mernory
by the system. rmanagerment ? Explain. S-09
CPU executes the process, so process management 18 There are two types of memories in computer system.
required throughout the execution. Many processes can Primary memory which includes RAM, ROM, PROM
run on the same program. Process management is an and EPROM etc. Secondary memory i3 a mass storage
activity which is handled by operating system. which includes Hard disk, FlTno disk, CD, DVD or
even HVD
The five major activities of an operating system related
RAM memory is a major part of primary memory or
to process management are as follows :
main-Imemory which is a large array of words or bytes.
(a) Creation and deletion of system and user Each word or byte has its own memory address by
processes: This activity creates and deletes the which it is referred.
user's as well as system's processes. CPU mainly deals with main memory to execute
(b) Suspension and resumption of processes: input/output calls given by it lts all instruct ions are
This activity suspends (temporary stops) and executed using main menory. Main nemory provides
continues the process as per situation which storage that can be access directly by the CPU That is
oCCurs in the system to say for a program to be execited, it must be in the
main memory.
Operating System (MSBTE) 2-8 Operating System Structure
The major activities of
Operating System(MSBTE) 2-9 Operating System Struclure
memory management
component of an operating system are: The five key activities of an operating system's file
1 To keep track of part of memory which are management component are:
currently being used and by whom? This 1. The creation and deletion of files.
facilitates to know how much memory is free and 2. The creation and deletion of directories.
occupied by which processes. 3. The support of primitives for manipulating files
2. Decide which process is to be loaded into main and directories.
memory when memory space becomes available. 4. The mapping of files ontosecondary storage.
3. Allocate and de-allocate memory space as per the 5 The back up of files on stable storage media ie. on
requirement. secondary storages.
2.1.3 File Management 2.1.4 Input/output System Management
a. System file management in details. S-10 a. Explain the VO system management component of OS.
A file is defined as collection of related data. A file State different function required in /0 system management.
conld be a program ie. collection of executable W-09
statements. It could be a simple data file which stores /O management is a major function of an operating
data defined by its owner or creator.
system which mange input output system inclusive of
Computer can store files on the disk (secondary hardware, VO devices with device drivers and its
storage), which provide long-term storage. Sone supporting systems.
examples of storage media are magnetic tape, magnetic /O subsystem hides the complexity of hardware
disk and optical disk. devices from the user. Only the device driver knows the
Every media from these Medias has its oWn peculiarities of the specifie device to which it is
characteristics like speed, capacity, and data transfer assigned.
rate and access methods. These devices are basically VO devices must be utilized properly so they will be
categorized on their capacity and even size.
utilized maxinum. So operating systern keeps track of
One of the main function of an operating system is to VO devices to assign jobs to it.
decide where and how to store the data on to the disk. When I/O devices are busy and job is in process then
It is assumed that storage devices stores data in the data are kept in the buffers and even some other
locations called as tracks, sectors and cluster. There is
techniques called spooling are used.
a special system which takes care of files and
directories. 2.1.5 Secondary-Storage Management
Drectoes are memory location which stores or
organizes files into it File systems normally organized Computer systems have difTerent levels ot storage,
intodirectories to ease ther use These dircctories may including primary storage, secondary storage and cache
contain files and other directions storage. Instructions and data must be placed in
Op

Operating System(MSBTE) 2-10 Operating System Structure Operating System(MSBTE) 2-11 Operating System Struct
prirnary storage or cache to be referenced by a running The functions of an operating ystem in case of
program. networking are different than just a stand-alone
Because main memory is too small to accommodate all operating system. Operating system takes care for data
data and programs, and there is a danger of data loss sharing, data sending, data receiving, routing data ete.
when power is lost, the computer system nust provide
secondary storage to back up main memory. 2.1.7 Protection System
Secondary storage consists of tapes, disks, and other If computer system has multiple users and if it is
media designed to hold information that will eventually allowing the Concurrent execution of multiple
be accessed in primary storage is ordinarily divided processes, then the various processes must be protected
into bytes or words consisting of a fixed number of from each other's actívities.
bytes.
Each location in storage has its own address. The set of
Protection is a mechanism for controlling the access of
all addresses is available to a program is called an programs, processes, or users to the resources defined
by the computer systen or machine.
address space.
The three chief tasks of an operating system in the 2.1.8 Command Interpreter System
context of secondary storage management are : A command interpreter is an interface between
(a) Managing free space existing on secondary operating system and the LISer. The User gives
storage devices. commands whích are executed by operating system.
(b) Allotment of storage space when new files have to
be written Or create.
The main function of a command interpreter is to get
(c) and execute the user specified command. It is not the
Setting up or scheduling the requests for memory part of the kernel, since multiple comnmand interpreters
access.
(E.g shell, in UNIX ) nay be supported by an operating
2.1.6 Networking system, and they do not really need to run in kernel
mode.
Networking is technology used to connect ultiple
computers in the network. A distributed system is a 2.2 Operating Systerms Services
collection of processors that do not share the resources
like memory, peripheral devices, or a clock. Write any four services provided by operating system, S-09
The processors communicate with one another through Operating system Sets an environment which is
Comimunication lines called network The suitable to execute the programs. Operating systen
communication network design must consider routing provides many services for smooth tunctioning of
and connection strategies. and the problems of overall systen.
contetion and seCuritv.
Cperating System(MSBTE)
212 Operating Syslem Structure Operating Systern (MSBTE) 2-13 Operating Systen Structure
Following are the major services provided by operating directs the input/ output operations with the help
systems for convenience of the users. of graphical control like menu ete.
User Interface
2.2.2 Program Execution
2. Program Execution
3. Input/output Operations The purpose of computer systems is to allow the user to
execute programs. So the operating systems provide an
4. Fille System Manipulation environment where the user can conveniently run
5 Communications programs. The user does not have to worry about the
6. Error Detection nemory allocation or multitasking or anything. These
7. Resource Allocation things are taken care of by the operating systems.
8. Accounting Running a program involves the allocating and de
allocating of memory and CPU scheduling in case of
Protection and security multi-process. These functions cannot be given to the
user level programs. So user's programs cannot be run
2.2.1 User Interface
independently without the help from the operating
systems.
User interface is a medium through which user 2.2.3 Input/output Operations
actually interacts with the computer system via
op ating system. Almo all operating systems have a Each program requires an input and produces output.
uset interface (UI. This involves the use of VO device or files. The
Usér interfaces are calégorz into three types as operating system hides the details of underlying
hardware of an VO from the user. User can run their
fws programs conveniently because they are not aware
(a) CLI : Conmand line interface, provides an about the VO system of OS.
environment where ser can Write their
For better efficiency and protection, the users are not
commands in text fornat on command prompts. allowed to direetiy interact with LO devices. So
(b) Batch interface: Batch interface allows a operating system here becomes the bridge between LO
cummand environment which gets execute one by devices and user
one or sequentially_User creates a batch file OS makes VO devices available to user in a user
which contains multiple executable commands in friendly manner whenever required by users
a sequence. This hatch file is executed to execute
the set of comrnands included in it 2.2.4 File System Manipulation
(e) GU: Graphical user interface Most of the The output of a progran may need to be written inte
operating systens provide graphucal interfaces new files or an be given as input to other files. The
which have tools like ponting devices which operating systems provide this service. The user does
Ope

Sting Syen seTE Cyerating System Stchure SOperating Systen (MSBTE) 2-18 Operating Systen Structure
bave worry about secondary storage
emet This service cannot be controlled by user programs
Uset gves a eemand or reading or writig to a fle because it involves monitoring and in cases altering
can see h§s task accomplished. Thus operatingg area of memory or de-allocation of memory for a faulty
sstes make t easier for user pregrams to aceomplish process, It can be even relinquishing the CPU of a
their task process that goes into an infinite loop.
Operating system even handles the issues related to These tasks are too critical to be handed over to the
the dàerent ermissions hke read, write, execute, and user programs. A user program may interfere with the
even acoess Geny depending on the ownership of the normal operation of the operating systems if they are
Sle
allowed to control errors..
t also inveves ereatìng, deleting er even searching of
the files bs its name ltis done by operating system. 2.2.7 Resource Allocation
22.5 Communications When multiple users Or multiple jobs running
concurrently, resources must be al located to each cf
There are instances where processes need to
them.
cmunicate with each other to exehange information. Many types of resources such as CPU cycles, main
may be between processes running on the same
eomputer or running on he different computers. memory, and file storage etc may have special
By providing this service the operating system relieves allocation code, others (such as V0 devices) may have
the user from the worry of passing messages between general request and release code.
pirocesses In case where the messages need to be 2.2.8 Accounting
passed to processes on the other computers through a
network it can be done by the user programs. To keep track of which users use how much and what
The user prgram may be anre developed as per the kinds of computer resources. It also helps in finding out
speafios of she hardware through which the message the usage statistics.
transits and provides the service interface to the It is even useful for the researchers to find out the
eperating system. usage and the requirements to reconfigure the system.
2.2.6 ErrorDetection 2.2.9 Protection and security
An error is one part of the system may Cause
The owners of information stored in a multi-user or
maltunctioning of the complete system. To avoid such a
networked computer system may want to control use of
situaton the operating system constantly monitors the that information. i.e access to data and other related
sYsten for detecting the errors, OS ensures that the privileges like reading, writing, executing etc
user should not be worried of errors propagating to
various part of the system and causing malfunctioning.
Operating System(MSBTE) 2-16
Operating Systen(MS8TE) 2-17
Operating System Strcure
Operating System Structure
System prograns provide basic funetioning to users so
Even the concurrent processes should not interfere that they do not need to write their own envirunment
with each other which may cause damage to the for program development Eg. editors, compilers ete.
information.
and program execution e.g. shells In some sense, they
Protection : This involves ensuring that all access to are bundles of use ful system calls.
system resources is controlled.
Figure for system call describes an example where cne
Security of the system from unwanted users requires file is copied on other fle. Consider two files one is
user authentication. The defending of external VO source and other is destination.
devices from invalid access is important. It is
If data is to be copied from one file to other then the ile
important to protect the system and keep it secured. names should be known. Either it should be initialized
The precautions must be instituted throughout the in the program or input should be taken interactively
system. from the user wvhen prompted.
2.3 System Calls When file names are inputted, system checks whether
file exists or do it require access permission if yes then
a. What is System call? W-08, WN-10 contents are read from the respective files. Just observe
a. What is the purpose of system calls? W-09 the above all actions where every tine system call is to
What is system call? S-09 be made by operating system to do each an every
action.
System calls provide an interface between the process After confirming details about a ile either error
and the operating system. System calls allow user-level
processes to reuest some services rom the operating messages are prompted an the file or further reading
and writing actions are made. In this example system
systen which process itself is not allowed to do. calls are needed for taking input from one ile and
In handling the trap, the operating system will enter in putting into another file.
the kernel mode, where it has access to privileged In short systen calls are:
instructions, and can perform the desired service on
the behalf of user-level process. Kernel is a main part
1. Programtning interface to the services provided
by the 0S. (system calls are medator between
or component of an operating system. OS and process)
It is because of the critical nature of operations that 2. Typically witten in a high-level language EgC
the operating system itself does then every time they or C+
are needed. 3. Mostly aecessed by programs via a high-level
For example, for VO a process involves a system call Application Program Interface APD rathber
telling the operating system to read or write particular than direet system call use
area and thi request is satisfied by the operating Three most conmon APIs are Win32 API for
system. Windows, POSIX API for POSIX based svstems
KOperating Systenm (aSBTE) 218
Operating System Structure
(lt incudes virtually all versions of UNIX, Operating System (MSBTE) 2-19 Operating System Structure
and Mac 0S X, and Java APE for the Java Linux, Most of the details of OS interface are hidden from
machine JVMD
virtual
Example of System call programmer by API. It is managed by run-time support.
library. Compiler includes set of functions built into
libraries.
Souoe e
Destination ile
Example Syste Cal Secuenoe User application
Acguire input Ble name Open( )
Wrhe promet to soreen system
Apcept input User call
Acgulre output Sle name mode
Wite prompt to soreen
Aocept input System call interface
Open tha input le kernel
itSle doesnl exist. abort mode
Create oubut le
if le exists, abort
Loop
Read trom input tile
Wrile to output tile open ()
Until ead fals implementation
Close output tile of open()
Wite oompletion messaga to screen system call
Terminate noally
return
Fig. 2.2:Example of system call
Fig. 2.3 :System call
implementation
2.3.1 System Call Implementation 2.3.2 System Call Parameter
Passing
Generally a number is associated with each system Frequently more information is required than simply
call. It is used to number the system calls. System-call identifying of desired system call. Exact type and
interface maintains a table indexed according to these amount of information vary according to OS and call
numbers There are two general methods used to
parameters to the OS. pass
The system call interface invokes intended system call
in 0S kernel and returns status of the system call and 1
Simplest : pass the parameters in
registers. In
ny return values. sOme cases, may be more parameters than
Thecaller needs toknow nothing about how the system registers. In such a case parameters are stored in
call is implemented. Just needs to use APl(application a block, or table, in memory. Then the
address of
interface) and understand what OS will do as a result block passed as a parameter in a register. This
call approach is used by Linux and Solaris.
Parameters are placed, or pushed, onto the stack
by the program and popped off the stack by the
ECprting Syem serE) 220 Operating Systerm Strutune Operatng System(MSaTE) 221 Operating Srtem Dructure
operating y t e Block and stack methods do not L Process control (Mainly used for process)
i i t the nunber or length f parameters being end, abort
pessed load. eKecute
Parameter passing via table create process, terrninate process
get proceas attributes, set process attributes
wait for time
wait eent, signal evert
allocate and free memory
Lsd adss
Uia parameters Code ior Describe fle managerment Enist the systerm calls for fle
cal 13 cal 1234 management. W-10
2 Pile management (Used for manipulation of files)
create file, delete file
open, ciose
Operatig system
read. write, reposition
Fic 24: Parameter pavsing via table get file attributes, set file attributes.
Device management (Used for managing devices)
24 Types of System Calis Request device, release device
Exçiain types of syste call W-08 Read. write, reposition
get device attributes, set device attributes
Enst any four system calls related to fles S-09
ts funcions
Logically attach or detach devices
Dtate t Systems cals with V-09
Lst aerent types of system calls merion their uses S-10
Information maintenance (To do information
maintenance)
Enfst ay our system cals lated wth process get tirne or date, set tirne ur date
management V-10
et sytem data, set sy stern data
There are diflerent systen calls made by an operating get process, file, or device attributes
ystem Dlerent Lypes are categozed as per their set process, file, or device attribute
ge Communications (Por communicatirng
calls)
Process contro 2. Flemanagement
ereate, delete communication connection
3. Device managemert 4 Information mainitenance send. receive messages
5. Commurications transfer status information
Most of the syste calls suypert, or are supperted by Attach or detach remote devices.
coepts and functns
Operating System (MSBTE) 2-22 Operating System Structure Operating System(MSBTE) 2-23 Operating System Structure
2.4.1 Process Control In case if the running program discovers an error in its
input and if it wants to stop abnormally, it may need to
Enlist any four system calts tor process management. W-10 define an error level.
When operating system runs a program it is necessary If the program does not run properly and if there are
to either halt program execution normally or many errors a high level error can be defined.
abnormally ie. abort operation has to be performed by Sometimes the program runs successfully means there
OS. are no errors, still the 0 level errors can be defined.
If a system call is made to terminate or stop the This is useful for command interpreter to understand
currently running program abnormally or if the next action.
program runs into a problemn and causes an error trap, Command executor executes the program given by a
a dump of nmemory is taken and an error processor. Generally multiple prograns can run at a
message
generated. time. So command interpreter executes the
process
Then memory dump is written to disk and may be assigned by operating system.
checked by a debugger. A debugger is a program which It is very important to understand that where the
is designed to aid the programmer in hnding and b e a o e t econtrol should return
when the process execution gets
correcting bugs to determine the cause of the problem. It is
necessary to find out the status of the
In normal or abnormal circumstances, the operating programn whether it is loaded, lost, saved, completely
executed ete.
system must transfer control to the invoking command
interpreter. The executing programn should be saved if
If use. writes commands then command interpreter returns to the existing program when the new control
executes it and reads the next command. It operating terminates. Memory image of the existing program
program
system is an interactive system, the command should be saved.
interpreter contìnues with the next command. Thus mechanism of calling one
program by another
program is etfectively created. If both programs
It is assumed that the user will issue an appropriate
command to respond to any error. In a GUIsystem, pop executes concurrently, we have created a new job or
up window might alert the user to the error and ask for process which can be multi programmed. Gienerally
guidance there is a system call specifically for this purpose.
In case of multitasking
The behavior of command interpreter is different in a environment, If ve
new job or process, or perhaps even a set ofcreate
a
batch system. Batch file usually terminates the entire jobs or
process, its execution has to be controlled. This control
job and continues with next job.
requires the ability to determiie and reset the
Some operating system allows control cards to show attributes of a job or process. It comprises the jobs
special recovery actions in case an error occurs. Control prioritv, its maximum allowable execution time and so
card is a command which manages the process On.
execution.
Operating System (MSBTE) 2-24 Operating Systen Structure Operating System(MSBTE) 2-25 Operating System Structure
We may even wish to terminate a job or process that Time related to a program when it gets execute is an
we have already created incase if we find that it is important factor. Many operating systems provide a
incorrect or is no longer needed. time profile of a program to indicate the amount of the
Sometimes we have to signal the processes or jobs that time that the program executes at a particular location
it has to stop at the particular event. After creating or at the set of locations. A time profile requires either
new jobs or processes, we may need to wait for them to a tracing facility or regular timer interrupts.
finish their execution.
When program gets execute at each an every
User nay want to wait for a certain amount of time to occurrence of the timer interrupt, the value of the
be passed or more probably we may wish want to wait program counter is recorded for the further use,
With
for a specific event to occur. The jobs or process should sufficiently frequent timer interrupts, a statistical
then signal when the event has occurred. The system
calls help here.
picture (i.e time recording and its analysis) of the time
There is a set of system call which is helpful in
spent on various parts of the program can be obtained.
debugging a program. It fnd outs errors. Many There are some of many facets of variations in process
systems provide system calls to dump memory (i.e. to and job control. Let us see examples one involving a
put in the memory). This provision is specially kept
for single-tasking system and the other invoking
multitasking system to clarify these concepts
debugging.
A program traces or searches
fromn lists each The MS-DOS operating system is single tasking
instruction as it is executed. Few systems provided this system. DOS has command interpreter that gets
facility invoked when the computer is start or boot. As
known as MS-DOS is single tasking it uses a simple method to
Even microprocessor provide a CPU mode
single step in which a trap is executed by the CPUto run a program and it does not create a new process.
alert every instruction. The trap is usually caught by a
MS DO loads the program into memory, writing over
debugger. most of itself to give the program as much memory as
Free mernory possible. After that it sets the instruction pointer to
section
the first instruction of the program. The program then
Free memory executes, and either an error cause a trap or program
SENCIOn
Procoss executes a system call to terminate.
In somne cases, the error code is saved in the system
memory for further use. After this the small portion of
Command Command
interpreter interpreter
program program command interpreter that was not overwritten restart
Kernel Kernel execution.
The first task is to reload the rest of the command
(a) At system starts (b) running a program
Fig. 2.5: Process control
interpreter from disk. Then the command interpreter
Operating System (MSBTE) 2-26
Operating System Structure Operating System(MSBTE) 2-27 Operating Systern Structure
makes the previous error code available to the
to the next user or running process, to change that program's priority and
program. SO On.
Example of multitasking is Free BSD which is derived
from Berkeley UNIX. When user logs Exit) system call gets run when the process is done.
the shell is given as per into this system, This system call returns status code of 0 or nonzero
the user's
shell concept is similar to the
MS-DOS. requirement. This error code to the invoking process .This status or error
As FreeBSD is a code is then available to the shell or other prograns.
interpreter may multitasking
continue
system, the command
running while another 2.4.2 File Management
program is executed. If there is
new process, the shell requirement to start a
executes fork ) system call.
An exec ) system call is
a Q. Describe file management. Enlist the system calls for file
load a
and executes. Again to start a program from memory management. W-10
executes a fork ) system cal. new process, the shell File creation and deletion are regular operations which
Exec (0 system call is used when user performs on the files. Here system call
requires
loaded into memory and after this selected isprogram is the name of the file and even file's attributes. Once the
program executed. file is created it has to be opened to use it.
Depending on the way the command was issued, the
shell then either waits for the There are multiple operation which could be
process to finish or runs the file. It could be done on
the process "in the background."
reading, wiring Or even
When a process is running in the repositioning. Finally we need to close the file, which
background it cannot
receive input directly from the keyboard indicates that user does not need it at that instance.
shell issuing this resource. Input / output because the
is therefore Directories are also used by users to organize their files
done through files or through a GUI interface. in a proper order. Even same sets of
directories are required. operations for
Process D For fles or directories some
times it is necessary to be
Free memory able to deternmine the values of
various attributes of
them may be reset them if
Process C necessary.
File attributes could be file nane, a file
Interpreter type. protection
codes, accounting information, and so on. For
Process B
and setting getting
KomelE
attributes at least two system calls are
required. Some operating systems provide more
calls such as calls for moving and copying files. systen
Fig. 2.6 : Free BSD running multiple programs
2.4.3 Device Management
While process runs the user is free to ask the shell to
execute other programs, to monitor the progress of the Describe device managenent ot operating system. S-09
Operating Systern Structure Operating System (MSBTE) 229 Operating System Sthucture
Operating Systerm (MSBTE) 2-28
2.4.4 Information Maintenance
Device management is one of the tedious functions
performned by an operating system. The devices which Information maintenance is a term used for the system
OS manages could be physical devices, abstract or may calls which maintains the information. There are many
be virtual device. system calls exist which are used for transferrìng
It is necessary to assign the different resources as per information between the user progran and the
will not
the requirement of the process so that itthere. operating system. Best example of this type of systen
unnecessarily wait and thus delays won't be calls is the system calls which return the curret time
to execute. E.g.
A process may require some resources and so on. In
and date.
main memory, disk drives, access to files, There are other types of system calls which may return
are available, they can be granted, information about the system like the number of
ease if the resBOurces user process
and control can be returned to the current users, the version number of the operating
gets free.
otherwise process has to wait until devices systemn, the amount of free memory or disk space, ete
which are
Operating system controls various resources, The operating system keeps information about all its
thought of as devices. processes and system calls are used to aceess this
necessary for
In case if OS is multi-users systet, it is users. Some information. Systems calls are also used to reset the
requested devices to the
OS to provide the process information i.e getting process attributes and
high priorities or
users may be exclusive (i.e. havingavailable. setting the process attributes.
privileges)where devices should be
the devices are
After user finished with the device, 2.4.5 Communication
and
released. These functions are similar to the open Communication is a main aspect of operating system.
system calls use for files. Some operating systems
close It results Communication takes place between the processes that
permit for unmanaged access to the devices. and is known as inter process communication
hazard like potential for device conflict
in
deadlocks. Two common nodels of inter process communication
When the device has been requested by operating
are

the device,
system, user can read, write and reposition Message passing model
similar to the way user does it with files. Shared memory model.
just
system each
In some special cases like UNIX operating In the message-passing model. the conmunicating
folder are treated as a
an every deVice, files as well as processes exchange message with one another tu
files and
file. In this case a set of system calls used on transfer the information
identified
devices are same, Sometines I/Odevices are There could be direct or indireet communication
by special file names, directory
placement or file
exchanging messages through n common mailbox The
attributes name of the process should be known to another
and
User interface can also make appearance of files process on the same system or at process on anothe
devices same, though the fundamental system calls are computer connected by a communicaton Thetwork
Tot same.
2.5

Operating System (MSBTE) 2-31 Operating System Structure


Operating System(MSBTE) 2-30 Operating System Structure ensuring that
Host name is given to each computer in a The processes are also responsible for
which it is known. A host even bas a networknetwork by they are not writing to the samne location at the same
like IP address. Similar to this each identifier
time.
process
process name, and this name is translated into has a
Instead of sharing memory, message passing is useful
identifier by which the operating system can refer anto for exchanging smaller amount of data, as there are no
the process.
conflicts to be avoided.
The identifier is then passed to the
general purpose
open and close calls provided by the file Message passing is also easier to implement than is
may be passed to specific open connection system. Or it shared memory for inter computer communication,
and close
connection calls provided by the file system depending since it can be done at memory speeds when it takes
onthe system's model of place within a computer.
communication.
Accept connection call has to be given by the recipient There are problem which exists in the areas of
process i.e. a kind of permission for protection and synch ronization between the processes
communication.
Most of the processes that will be receiving in sharing memory operating system structure.
are exclusive system programs providedconnections
for that Basically a system is large and complex. Modern
purpose. They execute a wait for connection call and operating system must be engineered carefully if it has
are awakened when a connection is made.
to function properly.
The communication source is known as the client and
the receiving is known as a server. The exchange A common approach or simple strategy is to partition
the task into small components rather than have one
messages by using re ad message and write messages
systen calls The close connection call terminates the monolithic system. Monolithic systems are like big
mess
communication.
Another model used for conmunication is Shared
Each of these modules should have a well-defined
portion of the system with carefully defined inputs,
memory model. This model use shared memory, outputs, and functions.
which creates and shares nemory. The system calls
are made to create and gain access to regions of 2.5 Operating System Structure
memory owned by other processes.
There are different types of operating system structure
Generally the operating system tries to avoid one
process from accessing another process's memory. For Some of them are subsequent:
sharing memory it is crucial that two or more processes 1. Simple structure
agree to remove this restriction,
2 Unix Layered and
They can then exchange information by reading and 3 MS-DOS Layer Structure
writing data in the shared memory areas. Processes 4 Micro kernel
determine the form of the data andthe location.
5. Monolithic system
Operating System Structure
Operating System(MSBTE) 2-32 Operating System Structure
Operating System (MSBTE) 2-33
2.5.1 Simple Structure 2.5.2 (a) UNIX Layered Structure
Kernel in UNIX is like heart in human
body. The
Some operating systems are commercial systems which kernel is further divided into a series of interfaces and
do not have well-defined structures or architecture. In drivers were
the beginning these operating systems were small and Aevdie driver_. These interfaces and device
UNIX has evolved
added on need basis due to which
simple. Even their scope was not known to us. traditional view of UNIX
over the years. Below is the
But then these operating systems grew more than their 2.7.
operating system in different layers in Fig.
scope. The best example of this type of OS is MS-DOS.
(The users)
MS-DOS was originally designed and implemented by
a few people who were unknown about the popularity Shells and commands
compilers and interpreters
of this product. system libraries
They never thought that this product will capture a System-call intertace to the kernel
very big market in the future. The purposes behind File system CPU scheduling
Signals teminal
writing were to provide the most functionality and use handling
Swapping block I/O page replacement
system demand paging
the least space. This is the reason that's why this OS is character /O system
terminal drivers disk ind tape drivers virtual memory
not divided into different modules.
Kernel interdace to the hardware
MS-DOS has not created interfaces, functional or
Mernory crantrollers
Iaccess levels. This has reduced the complications of OS Terminal controllers
terminals
Device controllers
disks and tapes physical memory
structure designing. This could be explained with the
example. Though any application runs on MS-DOS, it Fig 2.7 :UNIX systeni structure
used basic UO functions to execute its input and output which
There is a specific position of kernel. Everything
operations.
is below the system call interface and alhove the
This is a type of freedom which makes MS-DOS physical hardware is the kernel.
vulnerable to errant or malicious programs. Due to this The kernel provides the mai functions which are
entire system erashes when user programs fail. performed by operating system itself. Some of the
Reason to this was restricted by the hardware in those functions are file svst em. CTPU seheduling, memory
times. In those days Intel 8088 was unable to provide management, and other operating svstem functions
dualmode and no hardware protection. Because of this through systemn calls
the designer of MS-DOS had no choice but to leave the In short:
base hardware accessible. 1. MS-DOS WIilten to provide the mOst

One more exanple of limited structuring is the original functionality in the least space.
UNIX operating system. UNIX was also linited by 2. It is not divided into modules.
hardware functionality. It has mainly two separable
parts called the kernel and the system programs.
Operating System (MSBTE) 2-34 Operating System Structure Operaling System (MSBTE) Operating System Structrs
2-35

3
Although MS-DOS has Some structure, its In top to down approach the functions and features are
interfaces and levels of functionality are not well of OS are determined and they are divided into
separated. different components.
2.5.2 (b) MS-D0S Layer Structure and One of the methods to make OS modular is a Layered
Approach Layered
approach. In layered approach the operating system is
Q. Explain Layered OS structure S-09, S-10 broken up into a number of layers or levels. It forms a
Q. Describe layered approach less complicated structure of OS
to system design also write its
advantage and disadvantage. S-09 The bottom layer i.e. layer 0 is hardware and the
Operating systems can be broken into pieces with the highest (layer N) is the user interface layer. This
support or help of hardware. These parts will be layering structure is portrayed in Fig. 2.9.
smaller and more appropriate than those
the allowed by Layer N
original MS-DOS or UNIX Systems. user interface

Application program Layer 1

Layer O
Resident system program hardware

MS-DOS device drivers

ROM BIOS device drivers


Fig. 2.9 : Layered operating system
Fig. 2.8: MS-DOS Layered system An operating-system layer is an
abstract object consists of data andimplementation
of an
Good operating system can retain great control over the operations that
the computer and over the applications that make use can manipulate those data.
of that computer. A typical operating system for example consist of M
Operating system implementers can change the inner layers of data structures and a. set of functions or
workings of the system and create modular_operating routines that can be invoked by higher level layers. M
systes: can invoke operations on lower level layers. Also Laver
M can invoke operations of lower level layers.
Operating System (MSBTE) 2-36 Operating System Structure Operating System (MSBTE) 2-37 Operating Systern Structure
Important benefit of the layered approach is simplicity Then it calls the memory management layer, After that
of construction and debugging. The layers are selected it calls the CPU scheduling layer and then it is passed
so that each user function (operations) and services of to the hardware.
only lower level layers. This approach makes Modifications of the parameters at each layer are
debugging and system verification simpler. difficult as data needs to pass to different layers. It is
It is easy to debug first layer wvithout any worries for time consuming process than non layered system.
the rest of the system, because, by definition, it uses 2.5.3 Microkernel
only the basic hardware to implement its function.
In this way once the first layer is debugged., one by one Q. Explain following operating systen structure in detail.
other level are debugged and so on. if an error isfound 1. Microkemel W-09
during the debugging of a particular layer, the error Due to expansion of UNIX the Kernet has became
and
must be on the same layer. In this way the design large. It is very difficult to manage the kernel. In the
implementation of the system are simplified. mid-1980s, researchers at Carnegie Melon University
Each layer is implemented with only those operations developed an operating system called Mach that
which are facilitated by lower level layers. A layer modularized the kernel using the microkernel
to bother how these operations are
need not approach. This allowed kernel to be separated in
implemented. The layer needs to know only what these different nodules.
operations do exactly.
the Microkernel approach ensures the removal of all
Therefore it is essential for each layer to hide unnecessary components from the kernel and they are
operations and
existence of certain data structures, implemented as system and user level programs.
hardware from higher-level layers.
layered The result of this is a smaller kernel. The important
Defining layer is a main difficulty with the
thing here is which services should remain in the
approach. It involves appropriately defining various kernel and which should be implemented in user space
only
layers. The reason behind this is, a layer can use
lower level layers. Microkernel provides minimal process and memory
efficient
Layered implementation is incined to be less layered managemnent along with the communication function.
than other types. This is a major problem with The key function of the microkernel is to facilitate the
approach of designing OS structure. communication between the client program and the
There are different steps, which takes place in layered various services that are running in user space.
approach. Message passing is the way of comnunication used
operalion, it
When a user program esecules an 1/0 | In case if client program wish to aceess a file then it
layer.
executes a system call that i bappedte e /O must interact with the file server. There is no direct
interaction between client program and service. An)
do

Operating System(MSBTE) 2-38 Operating System Structure operating Systern (MSBTE) 2-39 Operating System Structure
interaction happens indirectly by exchanging messages Benefits of Microkernel model are:
with the microkernel. 1, Easier to extend a microkernel

Extending an operating system is one of the benefits of 2 Easier to port the operating systern to new
the microkernel approach. In this approach all new architectures.
services are added to user space which does not need 3 More. reliable (less code is running in kernel
mode)
modification of the kernel. IF kernel needs to modify, 4 More secured.
the changes are fewer, as the microkernel is a smaller
5 Very less Detrinents.
kernel. This results into operating system which can
be port from one hardware design to another
Since most of the services are running as a user process Guest apps Gues apps
rather than kernel processes, the microkernel is able to
GuestOS Guest 0S
provide more security and reliability. Incase if any
Virtual machine 0
service fails, the rest of the operating system remains Virtual machine N

untouched. Virtual machine platfom


User-Level Secure
Few modern operating systenms have used the Virtual machine monilor Driver Driver
Component
microkernel approach. Tru64 UNIX provides a UNIX Unprivileged
Miorokernel Pnvileged
interface to the user with a Mach Kernel.]
There is another example QNX. QNX is real time Embedded hardware
operating system based on the microkerneldesign. The
QNX microkernel provides services for message
Fig. 2.10: Microkernet
passing as well as process scheduling. 2.5.4 Monolithic System
There is a problem which can occur with microkernel
Q. Draw and explain monolithic strucdure of OS
and that is reduction in performance due to increased W-08
Q. Explain monolithic OS structure.
system function overhead. The best example of this is Q.
S-10, W-09
Windows NT first release. Describe monolthic operating system structure. W-10
Windows NT's Microkernel version resulted into low This is common approach for an organization This
approach can be referred as "Big mess". The structure
perfornance compared with that of Windows 95. can be described, as there is no structure. The
In short Microkernel: operating system is collection of procedures each of
Microkernel moves as much fron1 the kernel intbuSer" which can call any of the other ones whenever it needs
to.
space. Communication takcs place between L1ser This is a technique which is used where each procedure
modules using message pas g. in the system has a well-defined interface in terms of
Operating System (MSBTE) 2-40 Operating Systern Structure * Operating Systern (MSBTE) Operating Systern Structure *
2-41

parameters and results. Each procedure is free to call In this model for each system call there is one service
any other one. procedure that takes care of it. The utility procedures
In the construction of actual object program of the do things that are needed by several service
operating system when this approach is used, first procedures. E.g fetching data from user programs. The
compilers compile all the individual procedures, or files division of the procedure is shown in the figure.
containing the procedures. After this it binds them all 2.5.5 System boot
together into a single object fle using the file linker.
In terms of information hiding, there is essentially Q. Explain system booting in detail explain. S-09, S-10
none-every procedure is visible to every other Q. What are the steps involved in booting W-08
procedure or packages, in which much of the
information is hidden away inside modules, and only The procedure of starting a computer by loading the
the officially designed entry points can be called from kernel is known as booting the system. Bootstrap is a
outside the modules. smaller piece of code which finds outs where kernél is
Monolithic systems can even have a small structure. and locates it in main memory and starts its execution.
The system calls provided by the operating system are When the system is rebooted or powered up, the
requested by arranging parameters in well defined instruction registers are loaded in predefined memory
places such as in registers or on the stack and then
executing a special trap instruction known as a kernel locations, and then execution st arts. There exists a
call or supervisor call. program bootstrap loader. This program is stored in..
the read only memory. Read only data exists in ROM
Main Procedure
memory which is permanent.
Bootstrap is stored in ROM inst ead of RAM as RAM
Servio Prooedures memory is unknown in the initial stage when machine
(for system calls) starts or boots. But on the other hand ROM memory
does not require initialization and can not infect by
Utility routines virus problems.
(tor oomnon ta sks) The bootstrap program is very powerful which
Fig. 2.11: Monolithic structure of operating system. performs many activities. One of the activities is to
The monolithic organization propose a basic structure execute the diagnostic test This diagno stic test checks
for the operating system: whether all devices are in proper state to continue the
1 The main program which invokes the requested system program or not. It also initializes the CPU
Service procelure registers, device controllers etf After doirng these
2 The set of service procedures which carry out the activities it starts operating sy'stem in main nenory
systemn calls
The operating system software is actually stred tn the
3. A set of utility procedures that help the service disk of computer. But when bootstrap prograrn starta
procedures
Operating Systerm (MSBTE) 2-42 Operating System Structure Operating System (MSBTE) 2-43 Operating System Structure
the operating systen gets load in
main
RAMS memory. The reason behind thismemory is
or Switeh Protctad
Mede
mernory is small size due to which OS cannot be storedM
in main memory. CPU Rel Mode CPU in Protctod Mec

But in case of some lerie like MeR Boot Price alraliort


Cellular phones, PDA's
and game consoles, an operating system is
Starting
BOS Mastar Beol
Reennt
toadut
(Progran)
Karnet
initaitzation
Kafne(Fub Mocde
Frocéso
ROM memory. All forms of ROM stored in the
mermory
firmware. Different forms of ROM are PROM,
are called as OOs Serens Kormot
Services
EEPROM ete. EPROM,
Hardwae
The main problem with ROM is it
slowly. Some times solution for thisexecutes
problem
code very
solved by storing memory in ROM and could be
then by
Fig. 2.12 : Booting Process
transferring it to the main memory or RAM mernory. Exercise
Some major operating systema like
MAC, OS x stores the 0S into diskwindows, UNIX,
and then gets Short Questions
transfer into main memory Q.1 Explain concept of operating system structure.
Boot block is an area in the disk which reads and
then Q.2 List major system components.
transfers to main memory. The disk which has boot
partition is called as boot disk or system disk Q.3 What is process management ?
Once the full bootstrap program has been loaded. it Q.4 Write a note on main mernory
transverses the file system to find operating system
management.
What is Osystem managernent ?
kernel, loads it into memory and starta its execution.
At this point it is said that system running a.6 Explain secondary storage
management
Q.7 List operating system services.
In short i
1 Small piece of code called bootstrap loader, a.8 What is system call? List types of system cals.
locates the kernel, loads it into memery, and List fypes of operating system structures
starts it
a. 10 What are steps involved in booting.
Sometinestwo-step process where boot block at Long Questions
fixed location lods bòotstrap louder
3 fVhen power initialized on system, execution Explain system components in detail
starts at a fixed memory location Q.2 What are system services? Explain each type in detail.
Firmware used to hold initial boot code a.3 Explain types of system call types in detail.
operating System(MSBTE) operating Systerm (MSBTE) 245 Operating Systern Structura
2-44 Operating SystemStructure*
Exolain each operating structure in detail with the help of Winter 2009: Total Marks 16
suitable diagram.
functions fo be
Q. 18 What is process mnanagement ? State four
o5 Explain booting in detail perfomed by OS for process management.
(Section 2.1.1) (4 Marks)
26 BTE Questions and Answers two systems calls
Q. 19 What is the purpose of system calls? State (4 Marks)
Winter 2008: Total Marks 20 with its functions. (Sections 2.3 and 2.4)

Q. 20 Explain following operating system structure in


detail.
Q.1 State and explain six major components of system. I) Monolithic (Section 2.5.4)
(6 Marks) Microkernel (Section 2.5.3) (6 Marks)
(Section 2.1) iD)

Draw and explain monolithic structure of O.S. Q. 21 Explain the l/O systern management component of OS State
different function required in /O system management.
Q. 2
(4 Marks)
(Section 2.5.4) (Section 2.1.4) (6 Marks)
Q. 3 What is System call ?Explain types of system calls Summer 2010 : Total Marks 24
(6 Marks)
(Sections 2.3 and 2.4)

Q.4 What are the steps involved in booting ? (4 Marks) Q. 22 Draw neat diagram and explain operating systern structure
(Section 2.5.5) (4 Marks)
(Section 2.1)
Summer 2009 : Total Marks 24 Q. 23 List different types of system calls mention their uses

operating system (Section 2.4) (4 Marks)


Q. 5 Write any four services provided by (4 Marks)
(Section 2.2) Q. 24 List system component. Explain file management in details.
frona progran ? (Sections 2.1 and 2.1.3) (4 Marks)
Q. 6 What is process ? How is it different (4 Marks)
(Section 2.1.1) Q. 25 Explain system booting in detail explain. (Section 2.5.5)
system calls related to
Q.7 What is a system call ? Enlist any four (6 Marks)
files (Section 2.3) (4 Marks)
Q. 26 Explain
Q. 8 Describe device management of operating system (4 Marks) Monolithic OS structure (Section 2.5.4)
(Section 2.4.3)
() Layered OS structure (Section 2.5.2(b)) (6 Marks)
write its
Q.9 Describe layered approach to system design. Also Marks)
advantages and disadvantages. (Section 2.5.2(b) (4 Winter 2010 : To tal Marks 18
Q 10 What are
thedifferent responsibilities of memory
management ? Explain. (Section 2.1.2) (4 Marks) Q. 27 Describe mnonolithic operating system structure
(Section 2.5.4) (4 Marks)
operating System (MSeTE) 246 Operating Systern Structure
Q. 28 What issystem call? Enlist any four system cals related witn
process management. (Section 2.3 and 2.4) (4 Marks)
Q. 29 Describe file management. Enlist the system calls for file
inanagement. (Section 2.4) (4 Marks)
Q. 30 Enlist system components. Describe any two in details.
(Section 2.1) (6 Marks)

You might also like