In this blog, We have discussed structure of Operating Systems and many more...
1) Monolithic Operating System Structure
A monolithic kernel is an operating system structure where the entire
operating system is working in the kernel space and alone in supervisor
mode.
All the functionality resides in a single large module.
1. It is first structured but is very problematic from the standpoint of code
correctness since a code error anywhere can result in a system crash.
2. It was also hard to port or extend because code that needs to be changed
tends to be spread throughout the system, rather than being localized in one
place.
This organization suggests a basic structure for the operating system:
1. A main program that invokes the requested service procedure.
2. A set of service procedures that carry out the system calls.
3. A set of utility procedures that help the service procedures.
2) Layered Approach
This approach breaks up the operating system into different layers.
The
system had 6 layers :
Layer 0 split with the allocation of the processor, switching between processes
when interrupts occurred or timers expired. Layer 0 provided the basic
multiprogramming of the CPU.
Layer 1 did the memory management. It allocated space for processes in the main memory. Layer 1 software took care of making sure pages were brought
into memory whenever they were needed.
Layer 2 handled communication between each process and the operator
console. Above this layer, each process effectively had its own operator
console.
Layer 3 took care of managing the I/O devices and buffering the
information streams to and from them. Above layer 3 each process could
deal with abstract I/O devices with nice properties, instead of real devices
with many particularities.
Layer 4 was where the user programs were found. They did not have to
worry about process, memory, console, or I/O management.
The system operator process was located in layer 5.
So, With a layered approach, the bottom layer is the hardware, while the highest
layer is the user interface.
3) Client-Server Model
To distinguish two classes of processes, the servers, each of which provides
some service, and the clients, which use these services. This model is known
as the client-server model.
To request a service, such as reading a block of a file, a user process (now
known as the client process) sends the request to a server process, which
then does the work and sends back the answer.
In this model, the kernel handles the communication between clients and
servers. Communication between clients and servers is often by message
passing.
To obtain a service, a client process constructs a message saying what
it wants and sends it to the appropriate server. The server then does the work
and sends back the answer.
By splitting the operating system up into parts, each of which only handles
one aspect of the system, such as file service, process service, terminal service,
or memory service, each part becomes small and manageable.
Furthermore, because all the servers run as user-mode processes, and not in
kernel mode, they do not have direct access to the hardware.
As a
consequence, if a bug in the file server is triggered, the file service may crash,
but this will not usually bring the whole machine down.
Generalization of this idea is to have the clients and servers run on different
computers, connected by a local or wide-area network.
If a client
communicates with a server by sending it messages, the client need not know
whether the message is handled locally in its own machine, or whether it was
sent across a network to a server on a remote machine.
As far as the client is
concerned, the same thing happens in both cases: a request was sent and a
reply came back.
Thus the client-server model is an abstraction that can be
used for a single machine or for a network of machines.
--------------------------------------------------------------------------------------------------------------
System Calls
When a program in user mode requires access to RAM or a hardware
resource, it must ask the kernel to provide access to that resource. This is
done via something called a system call.
When a program makes a system call, the mode is switched from user mode to
kernel mode. This is called a context switch.
Then the kernel provides the resource which the program requested. After
that, another context switch happens which results in change of mode from
kernel mode back to user mode.
Generally, system calls are made by the user level programs in the following
situations:
Creating, opening, closing and deleting files in the file system.
Creating and managing new processes.
Creating a connection in the network, sending and receiving packets.
Type Of System Calls
1. Process control:
A running program needs to be able to stop execution either normally or
abnormally. There are system call such as end, abort, create, terminate,
allocate and free memory.
2. File management:
Some common system calls are create, delete, read, write, reposition,
or close. Also, there is a need to determine the file attributes –
get and set file attribute. Many times the OS provides an API to make
these system calls.
3. Device management:
Process usually requires several resources to execute, if these resources
are available, they will be granted and control returned to the user
process. There are system call such as request device, release device,
read, write, reposition.
4. Information maintenance:
Some system calls exist purely for transferring information between the
user program and the operating system. There are system call such as get
time and date, set time and date, get system data, set system data, get
process and file, set process and file.
5. Communication:
Create and delete communication, send and receive message, transfer
status information, attach or detach remote information.
Download link for more details: Structure of Operating System
Or follow my blog from the below link
Also, Join my Telegram channel with the below link
Also, join my Whatsapp group with the below link
0 Comments