Operating System Services and Components
Operating System Services and Components
Learning content mapped with Theory Learning Outcomes (TLO's) and CO's.
1.1 Operating System: concept, functions
1.2 Different types of Operating System: Batch Operating System, Multi-programmed, Time Shared Operating System,
Multiprocessor System, Distributed System, Real Time System, Mobile OS (Android OS)
1.3 Command line-based Operating System: DOS, UNIX GUI based Operating System: WINDOWS, LINUX, MaC OS
1.4 Different Services of Operating System, System Calls: Concept, types of system calls
1.5 Operating System Components: Process Management, Main Memory Management, File Management, IO
Management, Secondary Storage Management
Characteristics of O.S.
[Link]
1
OSY (315319)
[Link] management
[Link]
4. Interact with different software
[Link] management
[Link] Management
Advantages:
1. Os provides a GUI interface for the user in the form of menu icons and buttons .
2. Os also allow us to sharing the resources with other users
3. It helps user to understand the functions of a computer
4. It is very easy to use.
5. It can be easily updated
Disadvantages
[Link] the o.s is corrupted than it will be affected entire system and the computer system will not work .
[Link] same task run at a time. 1000-10 task will be run
List any four functions or operations of operating system.
Process Management
A process is a program in execution. A process needs certain resources, including CPU time, memory,
files, and I/O devices, to accomplish its task.
Managing the programs that are running. The operating system is responsible for the following activities in
connection with process management.
✦Process creation and deletion.
✦process suspension and resumption.
✦Provision of mechanisms for:
•process synchronization
•process communication
Main-Memory Management
Memory is a large array of words or bytes, each with its own address. It is a repository of quickly
accessible data shared by the CPU and I/O devices.
Main memory is a volatile storage device. It loses its contents in the case of system failure.
Managing and mentioning the memory between processes and data
The operating system is responsible for the following activities in connections with memory management:
♦Keep track of which parts of memory are currently being used and by whom.
♦Decide which processes to load when memory space becomes available.
♦Allocate and de-allocate memory space as needed.
File Management
A file is a collection of related information defined by its creator. Commonly, files represent programs
(Both source and object forms) and data.
The operating system is responsible for the following activities in connections with file management:
✦File creation and deletion.
✦Directory creation and deletion.
✦Support of primitives for manipulating files and directories.
✦Mapping files onto secondary storage.
✦File backup on stable (nonvolatile) storage media.
I/O System Management
Managing the input and output
The I/O system consists of:
✦A buffer-caching system
✦A general device-driver interface
✦Drivers for specific hardware devices
2
OSY (315319)
Secondary-Storage Management
Since main memory (primary storage) is volatile and too small to accommodate all data and programs
permanently, the computer system must provide secondary storage to back up main memory.
Managing the permanent Storage of data on disks or other media.
Most modern computer systems use disks as the principle on-line storage medium, for both programs and data.
The operating system is responsible for the following activities in connection with disk management:
✦Free space management
✦Storage allocation
✦Disk scheduling
Networking (Distributed Systems)
♦A distributed system is a collection processor that do not share memory or a clock. Each processor has
its own local memory.
♦The processors in the system are connected through a communication network.
♦Communication takes place using a protocol.
♦A distributed system provides user access to various system resources.
♦Access to a shared resource allows:
✦Computation speed-up
6. Security and Protection – Securing the system against possible unauthorized access to data or any other
entity. Protecting the parts of the system against damage.
List and draw a neat labelled diagram of four components of a computer system.
3
OSY (315319)
3. Applications programs – Define the ways in which the system resources are used to solve the computing
problems of the users (compilers, database systems, video games, business programs).
4. Users (people, machines, other computers).
Operating System views system point of view
Resource allocator – manages and allocates resources.
Control program – controls the execution of user programs and operations of I/O devices.
Kernel – The one program running at all times (all else being application programs).
Components of OS: OS has two parts.
(1) Kernel. (2) Shell.
(1) Kernel is an active part of an OS i.e.; it is the part of OS running at all times. It is a program which
can interact with the hardware. Ex: Device driver, dll files, system files etc.
(2) Shell is called as the command interpreter. It is a set of programs used to interact with the application
programs. It is responsible for execution of instructions given to OS (called commands).
Operating systems can be explored from two viewpoints: the user and the system.
User View: From the user’s point view, the OS is designed for one user to monopolize its resources, to
maximize the work that the user is performing and for ease of use.
System View: From the computer's point of view, an operating system is a control program that manages the
execution of user programs to prevent errors and improper use of the computer. It is concerned with the
operation and control of I/O devices.
List different types of operating systems
Different types of operating systems:
• Mainframe systems
• Multiprocessor systems
• Distributed systems
• Real time systems
[Link] Systems
Reduce setup time by batching similar jobs Automatic job sequencing – automatically transfers control from one
job to another. First rudimentary
operating system. Resident monitor
initial control in monitor
control transfers to job
when job completes control transfers pack to monitor
Explain [Link] operating system.
A batch operating system normally reads a stream of separate jobs (from a card reader. For example), each with
its own control cards that predefine to prevent errors and improper use of the computer. The batch os will work to
submit similar kinds of job together. In this os user do not interact directly with our computer system.
A batch system is one in which jobs are bundled together with the instruction necessary to allow them to be
processed without intervention. Often jobs of a similar nature can be bundled together to further increase
economy.
Common input devices were card readers and tape drives. The basic physical layout of the memory of batch job
computer is shown in fig.
The OS was simple, its major task was to transfer control from one job to the next. The job was submitted to the
computer operator in form of punch cards. At some later time the output appeared.
4
OSY (315319)
Advantages –it is useful when we working with large files which can take more time to execute
Disadvantage :-once the job is submitted the user did not have any interaction with it.
In this the operating system picks up and begins to execute one of the jobs from memory.
Once this job needs an I/O operation operating system switches to another job (CPU and OS always busy).
Jobs in the memory are always less than the number of jobs on disk (Job Pool).
If several jobs are ready to run at the same time, then the system chooses which one to run through the process
of CPU Scheduling.
In Non-multiprogrammed system, there are moments when CPU sits idle and does not do any work.
In Multiprogramming system, CPU will never be idle and keeps on processing.
Time Sharing Systems are very similar to Multiprogramming batch systems. In fact time sharing systems are an
extension of multiprogramming systems.
In Time sharing systems the prime focus is on minimizing the response time, while in multiprogramming the
prime focus is to maximize the CPU usage.
Example download software, transfer data, google chrome etc
5
OSY (315319)
As the system switches rapidly from one user to the next, each user is given the impression that the entire
computer system is dedicated to his use, even though it is being shared among many users.
The time sharing systems were developed to provide an interactive use of the computer system.
Example:-
In above figure the user 5 is active but user 1, user 2, user 3, and user 4 are in waiting state where as user 6 is in
ready status. As soon as the time slice of user 5 is completed, the control moves on to the next ready user i.e. user
6. In this state user 2, user 3, user 4, and user 5 are in waiting state and user 1 is in ready state. The process
continues in the same way and so on.
Example Linux, Unix
The time-shared systems are more complex than the multi-programming systems.
Explain 5 .Multiprocessor Operating System
Multiprocessor Operating System refers to the use of two or more central processing units (CPU) within a
single computer system. These multiple CPUs are in a close communication sharing the computer bus, memory
and other peripheral devices. The basic organization of multiprocessing system is shown in fig.
6
OSY (315319)
Distributed systems use multiple central processors to serve multiple real-time applications and multiple users.
Data processing jobs are distributed among the processors accordingly. The processors communicate with one
another through various communication lines (such as high-speed buses or telephone lines). These are referred as
loosely coupled systems or distributed systems. Processors in a distributed system may vary in size and
function. These processors are referred as sites, nodes, computers, and so on. The advantages of distributed
systems are as follows –
With resource sharing facility, a user at one site may be able to use the resources available at another.
Speedup the exchange of data with one another via electronic mail.
If one site fails in a distributed system, the remaining sites can potentially continue operating.
Better service to the customers.
Reduction of the load on the host computer.
Reduction of delays in data processing.
When many computers are interconnected to each other through a network for the purpose of sharing therir task
then it is called dos.
Advantages .if node is overused the dos shares all load to other node of network
Disadv, if the network is spread communication of all computers is broken
7
OSY (315319)
Hard real time means strict about adherence to each task deadline. When an event occurs, it should be serviced
within the predictable time at all times in a given hard real time system.
Example: -video transmission, each picture frame and audio must be transferred at fixed rate.
2. Soft real time: -
Soft real time means that only the precedence and sequence for the task operations are defined, interrupt latencies
and context switching latencies are small. There can be few deviations between expected latencies of the tasks
and observed time constraints and a few deadline misses are accepted.
Example: - Mobile phone, digital cameras and orchestra playing robots.
Switching Occurs when the currently running Carried out each time after the time slice
process stops. of process is finished.
Explain Mobile OS
A mobile operating system is the software platform on top of which other programs can run on mobile devices.
The operating system is responsible for determining the functions and features available on your device
The Android Operating System is a Linux-based OS developed by the Open Handset Alliance (OHA).
The Android mobile operating system is Google's open and free software stack that includes an operating
system, middleware and also key applications for use on mobile devices, including smartphones.
8
OSY (315319)
Android OS Architecture
1. Linux kernel
2. Libraries
3. Android Run time
4. Application Framework
5. Applications
Linux kernel
[Link] is third component of the android architecture and placed in second layer from bottom
[Link] provides most important part of android called Dalvik Virtual Machine.
[Link] Virtual Machine is similar to JVM but only difference is that it is designed and optimized for Android.
[Link] Virtual machine uses core functions of Linux such as memory management and multithreading and
enables each android app to run its own process.
Application framework
9
OSY (315319)
Following are the five services provided by operating systems to the convenience of the users.
1. Program Execution
The purpose of computer system is to allow the users to execute programs in an efficient manner. The operating
system provides an environment where the user can conveniently run these programs. The user does not have to
worry about the memory allocation or de-allocation or any other thing because these things are taken care of by
the operating system.
To run a program, the program is required to be loaded into the RAM first and then to assign CPU time for its
execution. Operating system performs this function for the convenience of the user. It also performs other
important tasks like allocation and de-allocation of memory, CPU scheduling etc.
2. I/O Operations
Each program requires an input and after processing the input submitted by user it produces output. This involves
the use of I/O devices. The operating system hides the user from all these details of underlying hardware for the
I/O. So the operating system makes the users convenient to run programs by providing I/O functions. The I/O
service cannot be provided by user-level programs and it must be provided by the operating system.
3. File System Manipulation
While working on the computer, generally a user is required to manipulate various types of files like as opening a
file, saving a file and deleting a file from the storage disk. This is an important task that is also performed by the
operating system.
Thus operating system makes it easier for the user programs to accomplish their task by providing the file system
manipulation service. This service is performed by the 'Secondary Storage Management' a part of the operating
system.
4. Communication
10
OSY (315319)
Operating system performs the communication among various types of processes in the form of shared memory.
In multitasking environment, the processes need to communicate with each other and to exchange
their information. These processes are created under a hierarchical structure where the main process is known as
parent process and the sub processes are known as child processes.
5. Error Detection
Operating system also deals with hardware problems. To avoid hardware problems the operating system
constantly monitors the system for detecting the errors and fixing these errors (if found). The main function of
operating system is to detect the errors like bad sectors on hard disk, memory overflow and errors related to I/O
devices. After detecting the errors, operating system takes an appropriate action for consistent computing.
This service of error detection and error correction cannot be handled by user programs because it involves
monitoring the entire computing process. These tasks are too critical to be handed over to the user programs. A
user program, if given these privileges; can interfere with the corresponding operation of the operating systems.
6. Resource allocation
In the multitasking environment, when multiple jobs are running at a time, it is the responsibility of an operating
system to allocate the required resources (like as CPU, main memory, tape drive or secondary storage etc.) to
each process for its better utilization. For this purpose various types of algorithms are implemented such as
process scheduling, CPU scheduling, disk scheduling etc.
7. Accounting
Operating system keeps an account of all the resources accessed by each process or user. In multitasking,
accounting enhances the system performance with the allocation of resources to each process ensuring the
satisfaction to each process.
8. 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.
9. Accounting
This service of the operating system keeps track of which users are using how much and what kinds of computer
resources have been used for accounting or simply to accumulate usage statistics.
10. Protection and Security
Protection includes in ensuring all access to system resources in a controlled manner. For making a system secure,
the user needs to authenticate him or her to the system before using (usually via login ID and password).
System Calls Implementation
System calls provide an interface between a user program and Operating System.
These are set of functions methods. Most system calls are written in assembly language and are machine
dependent.
Numerous higher level languages such as ‘C’ also permit to make system calls directly.
When program in user mode requires access to hardware resources, it must ask the kernel to provide access to that
resources .this is done by system call.
Hardware resources like CPU, memory and i/o devices
When program makes a system call the mode is switched from user mode to kernel mode this is call context
switch.
11
OSY (315319)
Kernel mode:-when cpu is in kernel mode the code or program being executed can access any memory address
and hardware resources hence kernel mode is powerful mode.
User mode :when cpu is in user mode the pgms don’t have direct access to memory and hardware resources
The system call interface layer includes entrance point in kernel code. All system resources are managed and
controlled by the kernel. Any request from user or application that occupies access to any system resource must
be tackled by kernel code. The user process must not be given entire access to kernel code for security cause.
Many opening into kernel code called system calls are provided to the user so that the user processes can raise the
execution of kernel code.
System calls permit processes and users to Operating System resources.
12
OSY (315319)
A) Process Control
Processes need to be controlled as in a running process must be able to halt its execution either normally or
abnormally. Also one process may need to run some other process to complete its own execution. So all these
system calls come under this category.
1. end, abort
2. load, execute
3. create process, terminate process
4. get process attributes, set process attributes
5. wait for time, wait event, signal event
6. allocate and free memory
B) File Management
System calls which deal with operations related to files fall under this type.
1. create file, delete file
2. open, close
3. read, write, reposition
4. get file attributes, set file attributes
13
OSY (315319)
C) Device Management
A process may need several resources for its execution. So system calls used for asking permission from the
kernel to use those resources are included in this type.
1. request device, release device
2. read, write, reposition
3. get device attributes, set device attributes
4. logically attach or detach devices
D) Information Maintenance
We need to keep all the information up to date so these system calls help us to do that.
1. get time or date, set time or date
2. get system data, set system data
3. get process, file, or device attributes
4. set process, file, or device attributes
E) Communication
Processes need to communicate with each other for many reasons like if they need certain resource which is held
by any other process. These system calls assist in doing so.
1. create, delete communication connection
2. send, receive messages
3. transfer status information
4. attach or detach remote devices
Operating System Component
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.).
It is important to note that a process is not a program. A process is only ONE instant of a program in execution.
There are many processes can be running the same program. The five major activities of an operating system in
regard to process management are
Creation and deletion of user and system processes.
Suspension and resumption of processes.
A mechanism for process synchronization.
A mechanism for process communication.
A mechanism for deadlock handling.
Main-Memory Management
Primary-Memory or Main-Memory is a large array of words or bytes. Each word or byte has its own address.
Main-memory provides storage that can be access directly by the CPU. That is to say for a program to be
executed, it must in the main memory.
The major activities of an operating in regard to memory-management are:
Keep track of which part of memory are currently being used and by whom.
Decide which process are loaded into memory when memory space becomes available.
Allocate and deallocate memory space as needed.
File Management
A file is a collected of related information defined by its creator. Computer can store files on the disk (secondary
storage), which provide long term storage. Some examples of storage media are magnetic tape, magnetic disk and
optical disk. Each of these media has its own properties like speed, capacity, data transfer rate and access
methods.
A file systems normally organized into directories to ease their use. These directories may contain files and other
directions.
14
OSY (315319)
The five main major activities of an operating system in regard to file management are
1. The creation and deletion of files.
2. The creation and deletion of directions.
3. The support of primitives for manipulating files and directions.
4. The mapping of files onto secondary storage.
5. The back up of files on stable storage media.
Secondary-Storage Management
Generally speaking, systems have several levels of storage, including primary storage, secondary storage and
cache storage. Instructions and data must be placed in primary storage or cache to be referenced by a running
program. Because main memory is too small to accommodate all data and programs, and its data are lost when
power is lost, the computer system must provide secondary storage to back up main memory. Secondary storage
consists of tapes, disks, and other media designed to hold information that will eventually be accessed in primary
storage (primary, secondary, cache) is ordinarily divided into bytes or words consisting of a fixed number of
bytes. Each location in storage has an address; the set of all addresses available to a program is called an address
space.
The three major activities of an operating system in regard to secondary storage management are:
1. Managing the free space available on the secondary-storage device.
2. Allocation of storage space when new files have to be written.
3. Scheduling the requests for memory access.
Networking
A distributed systems is a collection of processors that do not share memory, peripheral devices, or a clock. The
processors communicate with one another through communication lines called network. The communication-
network design must consider routing and connection strategies, and the problems of contention and security.
Protection System
If a computer systems 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 systems.
15
OSY (315319)
Question Answers:
Q1) What is process management? State for functions to be performed by OS for process management.
A Program does nothing unless its instructions are executed by a CPU. A program in execution is called a
process.
There may exist more than one process in the system which may require the same resource at the same time.
Therefore, the operating system has to manage all the processes and the resources in a convenient and efficient
way.
Some resources may need to be executed by one process at one time to maintain the consistency otherwise the
system can become inconsistent and deadlock may occur.
The operating system is responsible for the following activities in connection with Process Management
1. Scheduling processes and threads on the CPUs.
2. Creating and deleting both user and system processes.
3. Suspending and resuming processes.
4. Providing mechanisms for process synchronization.
5. Providing mechanisms for process communication.
2. Program Execution
The purpose of computer system is to allow the users to execute programs in an efficient manner. The operating
system provides an environment where the user can conveniently run these programs. The user does not have to
worry about the memory allocation or de-allocation or any other thing because these things are taken care of by
the operating system.
To run a program, the program is required to be loaded into the RAM first and then to assign CPU time for its
execution. Operating system performs this function for the convenience of the user. It also performs other
important tasks like allocation and de-allocation of memory, CPU scheduling etc.
2. I/O Operations
Each program requires an input and after processing the input submitted by user it produces output. This involves
the use of I/O devices. The operating system hides the user from all these details of underlying hardware for the
I/O. So the operating system makes the users convenient to run programs by providing I/O functions. The I/O
service cannot be provided by user-level programs and it must be provided by the operating system.
3. File System Manipulation
While working on the computer, generally a user is required to manipulate various types of files like as opening a
file, saving a file and deleting a file from the storage disk. This is an important task that is also performed by the
operating system.
16
OSY (315319)
Thus operating system makes it easier for the user programs to accomplish their task by providing the file system
manipulation service. This service is performed by the 'Secondary Storage Management' a part of the operating
system.
4. Communication
Operating system performs the communication among various types of processes in the form of shared memory.
In multitasking environment, the processes need to communicate with each other and to exchange
their information. These processes are created under a hierarchical structure where the main process is known as
parent process and the sub processes are known as child processes.
5. Error Detection
Operating system also deals with hardware problems. To avoid hardware problems the operating system
constantly monitors the system for detecting the errors and fixing these errors (if found). The main function of
operating system is to detect the errors like bad sectors on hard disk, memory overflow and errors related to I/O
devices. After detecting the errors, operating system takes an appropriate action for consistent computing.
This service of error detection and error correction cannot be handled by user programs because it involves
monitoring the entire computing process. These tasks are too critical to be handed over to the user programs. A
user program, if given these privileges; can interfere with the corresponding operation of the operating systems.
6. Resource allocation
In the multitasking environment, when multiple jobs are running at a time, it is the responsibility of an operating
system to allocate the required resources (like as CPU, main memory, tape drive or secondary storage etc.) to
each process for its better utilization. For this purpose various types of algorithms are implemented such as
process scheduling, CPU scheduling, disk scheduling etc.
7. Accounting
Operating system keeps an account of all the resources accessed by each process or user. In multitasking,
accounting enhances the system performance with the allocation of resources to each process ensuring the
satisfaction to each process.
8. 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.
9. Accounting
This service of the operating system keeps track of which users are using how much and what kinds of computer
resources have been used for accounting or simply to accumulate usage statistics.
10. Protection and Security
Protection includes in ensuring all access to system resources in a controlled manner. For making a system secure,
the user needs to authenticate him or her to the system before using (usually via login ID and password).
17
OSY (315319)
System calls-
System calls related to process control: End, Abort Load, Execute Create process, Terminate process Ready
process, Dispatch process Suspend, Resume Get Process attribute, set attribute Wait for time Wait event, signal
event
System calls Related to File management: Create file, delete file Open file , Close file Create directory Read,
write, Reposition Get file attribute , set file attribute Create a link Change the working directory
System calls Related to Device Management: Request a device, Release a device Read, Write, Reposition Get
device attribute, set device attribute
System calls Related to Information Maintenance: Get Time or Date, Set Time or Date Get System data,
Set system data Get process, file or device attributes Set process, file or Device attributes.
Q4) Explain how parameter passing is done while implementing system calls.
Three general methods exist for passing parameters to the OS:
1. Parameters can be passed in registers.
2. When there are more parameters than registers, parameters can be stored in a block and the block address can be
passed as a parameter to a register.
3. Parameters can also be pushed on or popped off the stack by the operating system.
18
OSY (315319)
19
OSY (315319)
listen to the last song on a cassette tape, he has to either fast-forward over all of the songs that come before it or
listen to them. There is no way to jump directly to a specific song.
20