24 Feb 2017

Unix 2.1 Architecture of Unix Operating System


ARCHITECTURE OF UNIX OPERATING SYSTEM




There are three levels: user, kernel, and hardware. 



The system call and library interface represent the border between user programs and the kernel. System calls look like ordinary function calls in C programs, and libraries map these function calls to the primitives needed to enter the operating system.

User Level
The libraries are linked with the programs at compile time and are thus part of the user program. Programs frequently use other libraries such as the standard I/O library to provide a more sophisticated use of the system calls. 

Kernel Level
The set of system calls are partitioned into those that interact with the :
 1. file subsystem 
 2. process control subsystem. 

The file subsystem manages files, allocating file space, administering free space, controlling access to files, and retrieving data for users. Processes interact with the file subsystem via a specific set of system calls, such as open (to open a file for reading or writing), close, read, write, stat (query the attributes of a file), chown (change the record of who owns the file), and chmod (change the access permissions of a file).

The file subsystem accesses file data using a buffering mechanism that regulates data flow between the kernel and secondary storage devices. The buffering mechanism interacts with block I/O device drivers to initiate data transfer to and from the kernel. Device drivers are the kernel modules that control the operation of peripheral devices. Block I/O devices are random access storage devices alternatively, their device drivers make them appear to be random access storage devices to the rest of the system.

The process control subsystem is responsible for process synchronization of inter-process communication, process scheduling, and memory management. The file subsystem and the process control subsystem interact when loading a file in the memory for execution, the process subsystem read executable files into memory before executing them.

The scheduler module allocates the CPU to processes. It schedules them to run in turn until they voluntarily relinquish the CPU while awaiting a resource or until the kernel preempts them when their recent run time exceeds a time quantum. The scheduler then chooses the highest priority eligible process to run; the original process will run again when it is the highest priority eligible process available.

The memory management module controls the allocation of memory. If at any time the system does not have enough physical memory for all processes, the kernel moves them between main memory and secondary memory so that all processes get a fair chance to execute.

Hardware Level
The hardware control is responsible for handling interrupts and for communicating with the machine. Devices such as disks or terminals may interrupt the CPU while a process is executing. If so, the kernel may resume execution of the interrupted process after servicing the interrupt. Interrupts are not serviced by special processes but by special functions in the kernel, called in the context of the currently running process.

Friends, if you find this post useful please comment below. If you want quick notes for any topic please mail us at hardikpanchal551@gmail.com, we will try to provide notes if possible. Thanks for reading.

No comments:

Post a Comment