Chapter 2 - Operating System Structures
Chapter 2 - Operating System Structures
2-1
For improving speed of computer’s response to its users, several programs
should be kept in memory at a time. To handle this situation various memory
management techniques can be used.
Operating system is responsible for following activities related to memory
management.
- Keeping track of which parts of memory are currently being used and
by whom
- Deciding which processes and data to move into and out of memory
- Allocating and de-allocating memory space as needed
2.2.5 Communication
One process may need to exchange some information with another process.
The communicating processes may be either on the single machine or they may
be on different machines. Operating system must be able to provide
communication services.
2-3
2.2.7 Resource Allocation
A computer system may get used by multiple users at a time. Also a
computer system may execute multiple jobs at a time. So, proper resource
allocation must be done to the multiple users or multiple jobs so that proper
resource utilization can be achieved. Various resources that should be managed
are CPU, main memory, files, I/O devices etc.
2.2.8 Accounting
Operating system may keep track of users using various resources. The
record keeping can be maintained regarding which users are using which
resources and for how much period. This statistics can be used for charging the
users (if required). The major use of this statistics is to reconfigure the system for
improving the overall performance the system.
2-4
User application
-
-
//Implementation of
-
//system call
--
- --
- --
- --
- --
return;
Register
Abc
Load Register
System call 21 Code for
Use Abc
system call 21
User Program
Operating System
2-5
Problem with the above approach is that there may be more parameters
than the available registers. In such case, parameters are stored in a block of
memory and address of this block is passed as parameter in the register. This
approach is used by Linux and Solaris.
In the third method, parameters are pushed onto stack by the user
program and they are popped by the code of system call.
2-7
Some system calls are there for returning (get system data system call) or
setting (set system data system call) some system information like number of
users currently using the system, version number of operating system, amount of
free memory or disk, details of current process in the system and so on.
Additionally all the information related to processes, files and devices need
to be determined or set. For that purpose system calls are available.
2-8
Kernel
Other OS routines
Application Programs
Different operating system structures have been defined which decides size
and functionality of kernel and organization of different components of operating
system. Some of them are,
- Simple or Monolithic Structure
- Layered Structure
- Microkernel Structure
Main
procedure
Service
procedures
Utility
procedures
This structure has very few interfaces between application programs and
hardware. One more model of monolithic structure is shown in following figure.
2-9
Application Program Application Program Application Program User Mode
Module 1 Module 2
Module 3 Module 4
Kernel
Modules
Hardware
Advantage
- As very less number of interfaces is available between application
programs and hardware, system provides good and secured performance.
Disadvantage
- It is difficult to maintain such system. Modification done in one module can
affect other module of the system.
Example
- MS DOS
2-10
Layer 0 -
Hardware
Layer 1
...
Layer n - User
Interface
Advantage
- Main advantage is simplicity of construction and debugging.
Disadvantages
- All the requests (even if it is a very small task) pass through multiple
layers before they reach to hardware. Each layer adds overhead to system
call.
- It is difficult to design the layers
Examples
- THE – OS for Dutch system
- MULTICS
- UNIX
2-11
Application Program Application Program
User Mode
File Server Print Server Display Server
Hardware
Advantages
- Extending the operating system is easy as all the new services can be
added to outside the kernel (i.e. modifications to kernel are not required).
- As microkernel is not needed to be modified, such operating systems can be
portable to any hardware easily.
- As most of the services are running outside the kernel, even if any service
fails, it does not affect the kernel. Thus makes the operating system more
secure and reliable.
Disadvantage
- Extensive message passing may degrade the overall performance of the
system.
Examples
- Mach
- QNX
2.6 Booting
Booting is nothing but changing the state of computer from sleep state to
wakeup state. When computer is powered on or restarted, it does not have
operating system in random access memory (i.e. main memory). The computer
first executes a relatively small program stored in read-only memory (ROM or
EEPROM).
The small program that starts this sequence is known as a bootstrap
loader, bootstrap or boot loader. This small program's only job is to load other
data and programs which are then executed from RAM.
On receiving boot signal, some computer systems may load a very small
number of fixed instructions into memory at a specific location, initialize at least
one CPU, and then point the CPU to the instructions and start their execution.
These instructions typically start an input operation from some peripheral device.
2-12
Other systems may send hardware commands (such as "read sector zero of
the system device into memory starting at location 0F00") directly to peripheral
devices or I/O controllers that cause an extremely simple input operation to be
carried out (loading a small number of boot loader instructions into memory).
Then execution of the instructions starts by the CPU.
Kernel (heart of operating system) is located and loaded into memory.
Operating System starts executing first process such as ‘init’ and waits for
interrupts to occur (Now computer is ready).
Normal sequence of operation that is performed when computer boots is as
follows
1. Check CMOS (Complementary Metal Oxide Semiconductor) setup
2. Load interrupt handlers and device drivers
3. Initialize registers and power management
4. Perform POST (Power On Self Test)
5. Display System Settings
6. Determine bootable devices
7. Initiate the bootstrap sequence
2-13