Lecture Notes On Operating Systems
Lecture Notes On Operating Systems
١
3. Operating Systems Structure
There are several vantage points from which to view an operating system.
One is by examining the services it provides. Another is by looking at the interface
it makes available to users and programmers. A third is by disassembling the
system into its components and their interconnections. In this lecture, we explore
all three aspects of operating systems, to show them from the viewpoints of users,
programmers, and operating-system designers.
Process Management
The operating system manages many kinds of activities ranging from user
programs to system programs like printer spooler, name servers, file server etc.
Each of these activities is encapsulated in a process. A process includes the
complete execution context (code, data, PC, registers, OS resources in use etc.).
٢
The five major activities of an operating system in regard to process management
are:
Main-Memory Management
Main-Memory is a large array of words or bytes. Each word or byte has its
own address. Main memory is a repository of quickly accessible data shared by the
CPU and I/O devices. The central processor reads instructions from main memory
during the instruction-fetch cycle, and both reads and writes data from main
memory during the data-fetch cycle. The I/O operations implemented via DMA
also read and write data in main memory. The main memory is generally the only
large storage device that the CPU is able to address and access directly.
To improve both the utilization of CPU and the speed of the computer's
response to its users, we must keep several programs in memory. There are many
different memory-management schemes. The major activities of an operating
system in regard to memory-management are:
Keep track of which part of memory are currently being used and by whom.
Decide which processes are loaded into memory when memory space
becomes available.
Allocate and deallocate memory space as needed.
٣
File Management
A file system normally organized into directories to ease their use. These
directories may contain files and other directions. The five main major activities of
an operating system in regard to file management are:
Secondary-Storage Management
Networking
Protection System
If a computer system has multiple users and allows the concurrent execution
of multiple processes, then the various processes must be protected from one
another's activities. Protection refers to mechanism for controlling the access of
programs, processes, or users to the resources defined by a computer system. This
mechanism must provide a means for specification of the controls to be imposed,
together with a means of enforcement.
٥
3.2 Operating Systems Services
An operating system provides an environment for the execution of programs.
The operating system provides certain services to programs and to the users of
those programs. The specific services provided will, of course, differ from one
operating system to another, but there are some common classes that we can
identify. These operating-system services are provided for the convenience of the
programmer, to make the programming task easier.
Program Execution
The system must be able to load a program into memory and to run it. The
program must be able to end its execution, either normally or abnormally
(indicating error).
I/O Operations
A running program may require I/O. This I/O may involve a file or an I/O
device. For specific devices, special functions may be desired (such as rewind a
tape drive, or blank the screen on a CRT). For efficiency and protection, users
usually cannot control I/O devices directly. Therefore, the operating system must
provide some means to do I/O.
The output of a program may need to be written into new files or input taken
from some files. The operating system provides this service. The user does not
have to worry about secondary storage management. User gives a command for
reading or writing to a file and sees his/her task accomplished. Thus operating
system makes it easier for user programs to accomplish their task.
Error Detection
An error is one part of the system may cause malfunctioning of the complete
system. To avoid such a situation the operating system constantly monitors the
system for detecting the errors. This relieves the user of the worry of errors
propagating to various part of the system and causing malfunctioning.
٦
3.3 System Calls and System Programs
System calls provide the interface between a process and the operating
system. These calls are generally available as assembly-language instructions, and
are usually listed in the manuals used by assembly-language programmers. Some
systems may allow system calls to be made directly from a higher-level language
program, in which case the calls normally resemble predefined function or
subroutine calls. They may generate a call to a special run-time routine that makes
the system call, or the system call may be generated directly in-line.