OS - Module1 - Apsima IV
OS - Module1 - Apsima IV
Module 1
INTRODUCTION
Syllabus:
Operating System
● An operating system (OS) is the program that, after being initially loaded into
the computer by a boot program, manages all of the other application
programs in a computer.
● The application programs make use of the operating system by making
requests for services through a defined application program interface (API).
● In addition, users can interact directly with the operating system through a
user interface, such as a command-line interface (CLI) or a graphical UI
(GUI).
Operating Systems _Btech2019_PartTime_Semseter2 2
○ Security –
■ The operating system uses password protection to protect user
data and similar other techniques.
■ it also prevents unauthorized access to programs and user data.
○ Control over system performance –
■ Monitors overall system health to help improve performance.
■ Records the response time between service requests and system
response to have a complete view of the system health.
■ This can help improve performance by providing important
information needed to troubleshoot problems.
○ Job accounting –
■ Operating system Keeps track of time and resources used by
various tasks and users.
■ This information can be used to track resource usage for a
particular user or group of users.
○ Error detecting aids –
■ Operating system constantly monitors the system to detect
errors and avoid the malfunctioning of the computer system.
○ Coordination between other software and users –
■ Operating systems also coordinate and assign interpreters,
compilers, assemblers and other software to the various users of
the computer systems.
○ Memory Management –
■ The operating system manages the Primary Memory or Main
Memory.
■ It keeps track of primary memory, i.e., which bytes of memory
are used by which user program.
Operating Systems _Btech2019_PartTime_Semseter2 3
○ Program Execution:
■ The Operating System is responsible for execution of all types
of programs whether it be user programs or system programs.
■ The Operating System utilises various resources available for
the efficient running of all types of functionalities.
○ Handling Input/Output Operations:
■ The Operating System is responsible for handling all sorts of
inputs, i.e, from keyboard, mouse, desktop, etc.
Operating Systems _Btech2019_PartTime_Semseter2 4
○ Step 3) Once system call execution is over, control returns to the user
mode.,
○ Step 4) The execution of user processes resumed in Kernel mode.
○ Process Control
■ This system calls perform the task of process creation, process
termination, etc.
■ Functions:
● End and Abort
● Load and Execute
● Create Process and Terminate Process
● Wait and Signed Event
● Allocate and free memory
○ File Management
■ File management system calls handle file manipulation jobs like
creating a file, reading, and writing, etc.
■ Functions:
● Create a file
● Delete file
● Open and close file
● Read, write, and reposition
● Get and set file attributes
○ Device Management
■ Device management does the job of device manipulation like reading
from device buffers, writing into device buffers, etc.
■ Functions
● Request and release device
● Logically attach/ detach devices
● Get and Set device attributes
○ Information Maintenance
■ It handles information and its transfer between the OS and the user
program.
■ Functions:
● Get or set time and date
● Get process and device attributes
○ Communications
■ These types of system calls are specially used for interprocess
communications.
■ Functions:
● Create, delete communications connections
● Send, receive message
● Help OS to transfer status information
● Attach or detach remote devices
Operating Systems _Btech2019_PartTime_Semseter2 8
CreateProcess()
Process control ExitProcess() fork() exit() wait()
WaitForSingleObject()
SetConsoleMode()
Device manipulation ReadConsole() ioctl() read() write()
WriteConsole()
GetCurrentProcessID()
Information maintenance getpid() alarm() sleep()
SetTimer() Sleep()
CreatePipe()
Communication CreateFileMapping() Pipe() shm_open() mmap()
MapViewOfFile()
SetFileSecurity()
InitializeSecurityDescriptor(
Protection Chmod() Umask() Chown()
) SetSecurityDescriptor
Group ()
CreateProcess()
Process control ExitProcess() fork() exit() wait()
WaitForSingleObject()
SetConsoleMode()
Device manipulation ReadConsole() ioctl() read() write()
WriteConsole()
GetCurrentProcessID()
Information maintenance getpid() alarm() sleep()
SetTimer() Sleep()
Operating Systems _Btech2019_PartTime_Semseter2 9
● Simple structure:
○ Such operating systems do not have well defined structure and are small,
simple and limited systems.
○ The interfaces and levels of functionality are not well separated.
○ MS-DOS is an example of such an operating system.
○ In MS-DOS application programs are able to access the basic I/O routines.
○ These types of operating systems cause the entire system to crash if one of the
user programs fails.
○ Diagram of the structure of MS-DOS is shown below.
○
○ Advantages of Simple structure:
■ It delivers better application performance because of the few interfaces
between the application program and the hardware.
■ Easy for kernel developers to develop such an operating system.
○ Disadvantages of Simple structure:
■ The structure is very complicated as no clear boundaries exist between
modules.
■ It does not enforce data hiding in the operating system.
Operating Systems _Btech2019_PartTime_Semseter2 10
● Layered structure:
○ An OS can be broken into pieces and retain much more control on the system.
○ In this structure the OS is broken into a number of layers (levels).
○ The bottom layer (layer 0) is the hardware and the topmost layer (layer N) is
the user interface.
○ These layers are so designed that each layer uses the functions of the lower
level layers only.
○ This simplifies the debugging process as if lower level layers are debugged
and an error occurs during debugging then the error must be on that layer only
as the lower level layers have already been debugged.
○ The main disadvantage of this structure is that at each layer, the data needs to
be modified and passed on which adds overhead to the system.
○ Moreover careful planning of the layers is necessary as a layer can use only
lower level layers.
○ UNIX is an example of this structure.
○
● Micro-kernel:
○ This structure designs the operating system by removing all non-essential
components from the kernel and implementing them as system and user
programs.
○ This results in a smaller kernel called the micro-kernel.
○ Advantages of this structure are that all new services need to be added to user
space and does not require the kernel to be modified.
○ Thus it is more secure and reliable as if a service fails then the rest of the
operating system remains untouched.
○ Mac OS is an example of this type of OS.
○ Microkernel architecture is small and isolated therefore it can function better.
○ Providing services in a microkernel system are expensive compared to the
normal monolithic system
○
● The CPU initializes itself after the power in the computer is first turned on.
● This is done by triggering a series of clock ticks that are generated by the system
clock.
● After this, the CPU looks for the system’s ROM BIOS to obtain the first instruction in
the start-up program.
● This first instruction is stored in the ROM BIOS and it instructs the system to run
POST (Power On Self Test) in a memory address that is predetermined.
● POST first checks the BIOS chip and then the CMOS RAM.
● If there is no battery failure detected by POST, then it continues to initialize the CPU.
● POST also checks the hardware devices, secondary storage devices such as hard
drives, ports etc. And other hardware devices such as the mouse and keyboard.
● This is done to make sure they are working properly.
● After POST makes sure that all the components are working properly, then the BIOS
finds an operating system to load.
● In most computer system’s, the operating system loads from the C drive onto the hard
drive.
● The CMOS chip typically tells the BIOS where the operating system is found.
● The order of the different drives that CMOS looks at while finding the operating
system is known as the boot sequence.
● This sequence can be changed by changing the CMOS setup.
● After finding the appropriate boot drive, the BIOS first finds the boot record which
tells it to find the beginning of the operating system.
● After the initialization of the operating system, the BIOS copies the files into the
memory. Then the operating system controls the boot process.
● In the end, the operating system does a final inventory of the system memory and
loads the device drivers needed to control the peripheral devices.
● The users can access the system applications to perform various tasks.
Operating Systems _Btech2019_PartTime_Semseter2 14
Questions
● Monolithic System
○ The entire operating system works in the kernel space in the monolithic
system.
○ This increases the size of the kernel as well as the operating system.
○ This is different from the microkernel system where the minimum software
that is required to correctly implement an operating system is kept in the
kernel.
○ The kernel provides various services such as memory management, file
management, process scheduling etc. using function calls.
○ This makes the execution of the operating system quite fast as the services
are implemented under the same address space.
○
○ Differences Between Microkernel and Monolithic
Kernel
■ The microkernel is much smaller in size as compared to the monolithic
kernel.
■ The microkernel is easily extensible whereas this is quite complicated
for the monolithic kernel.
■ The execution of the microkernel is slower as compared to the
monolithic kernel.
■ Much more code is required to write a microkernel than the monolithic
kernel.
■ Examples of Microkernel are QNX, Symbian, L4 Linux etc.
Monolithic Kernel examples areLinux, BSD etc.
○ Advantages of Monolithic Kernel
■ The execution of the monolithic kernel is quite fast as the services such
as memory management, file management, process scheduling etc.are
implemented under the same address space.
■ A process runs completely in a single address space in the monolithic
Operating Systems _Btech2019_PartTime_Semseter2 16
kernel.
■ The monolithic kernel is a static single binary file.
○ Disadvantages of Monolithic Kernel
■ If any service fails in the monolithic kernel, it leads to the failure of the
entire system.
■ To add any new service, the entire operating system needs to be
modified by the user.
●
● Advantages of Batch Operating System:
○ It is very difficult to guess or know the time required for any job to
complete. Processors of the batch systems know how long the job
would be when it is in queue
○ Multiple users can share the batch systems
○ The idle time for the batch system is very less
○ It is easy to manage large work repeatedly in batch systems
● Disadvantages of Batch Operating System:
○ The computer operators should be well known with batch systems
Operating Systems _Btech2019_PartTime_Semseter2 17
●
● Advantages of Time-Sharing OS:
○ Each task gets an equal opportunity
○ Fewer chances of duplication of software
○ CPU idle time can be reduced
● Disadvantages of Time-Sharing OS:
○ Reliability problem
○ One must have to take care of the security and integrity of user
programs and data
○ Data communication problem
computer technology and are being widely accepted all over the world and,
that too, with a great pace.
● Various autonomous interconnected computers communicate with each other
using a shared communication network.
● Independent systems possess their own memory unit and CPU.
● These are referred to as loosely coupled systems or distributed systems.
● These system’s processors differ in size and function.
● The major benefit of working with these types of the operating system is that
it is always possible that one user can access the files or software which are
not actually present on his system but some other system connected within this
network i.e., remote access is enabled within the devices connected in that
network.
● Examples of Distributed Operating Systems are- LOCUS, etc.
●
● Advantages of Distributed Operating System:
○ Failure of one will not affect the other network communication, as all
systems are independent from each other
○ Electronic mail increases the data exchange speed
○ Since resources are being shared, computation is highly fast and
durable
○ Load on host computer reduces
○ These systems are easily scalable as many systems can be easily added
to the network
○ Delay in data processing reduces
Operating Systems _Btech2019_PartTime_Semseter2 19
●
● Advantages of Network Operating System:
○ Highly stable centralized servers
○ Security concerns are handled through servers
Operating Systems _Btech2019_PartTime_Semseter2 20
●
● Examples of Real-Time Operating Systems are: Scientific experiments,
medical imaging systems, industrial control systems, weapon systems, robots,
air traffic control systems, etc.
● Advantages of RTOS:
○ Maximum Consumption: Maximum utilization of devices and system,
thus more output from all the resources
○ Task Shifting: The time assigned for shifting tasks in these systems are
very less. For example, in older systems, it takes about 10
microseconds in shifting one task to another, and in the latest systems,
it takes 3 microseconds.
○ Focus on Application: Focus on running applications and less
importance to applications which are in the queue.
○ Real-time operating system in the embedded system: Since the size of
programs are small, RTOS can also be used in embedded systems like
in transport and others.
○ Error Free: These types of systems are error-free.
○ Memory Allocation: Memory allocation is best managed in these types
of systems.
● Disadvantages of RTOS:
○ Limited Tasks: Very few tasks run at the same time and their
concentration is very less on few applications to avoid errors.
○ Use heavy system resources: Sometimes the system resources are not
so good and they are expensive as well.
Operating Systems _Btech2019_PartTime_Semseter2 22
Tasks of the operating system are done by Tasks of the operating system are done
the master processor. individual processor
● Enhanced Throughput
○ If multiple processors are working in tandem, then the throughput of
the system increases i.e. number of processes getting executed per unit
Operating Systems _Btech2019_PartTime_Semseter2 23
of time increase.
○ If there are N processors then the throughput increases by an amount
just under N.