0% found this document useful (0 votes)
109 views8 pages

Learning Materials-Chapter-2-OS

The document discusses operating system concepts including the differences between multiprogramming and time-sharing systems, common operating system services, system calls, and types of system calls. Multiprogramming allows multiple programs to use the CPU at the same time, while time-sharing gives each user their own terminal and the feeling of sole CPU usage by using multiprogramming to share CPU time between users. Operating systems provide services like program execution, I/O operations, file system manipulation, communication, error detection, resource allocation, and protection. System calls provide an interface for user processes to request services from the operating system, and include process control, file management, device management, information maintenance, and communication functions.

Uploaded by

Sheeraz Arif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views8 pages

Learning Materials-Chapter-2-OS

The document discusses operating system concepts including the differences between multiprogramming and time-sharing systems, common operating system services, system calls, and types of system calls. Multiprogramming allows multiple programs to use the CPU at the same time, while time-sharing gives each user their own terminal and the feeling of sole CPU usage by using multiprogramming to share CPU time between users. Operating systems provide services like program execution, I/O operations, file system manipulation, communication, error detection, resource allocation, and protection. System calls provide an interface for user processes to request services from the operating system, and include process control, file management, device management, information maintenance, and communication functions.

Uploaded by

Sheeraz Arif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Chapter-02 (Operating Systems Structure)

Dr. Sheeraz Arif (Assoc. Professor)


What is the difference between Multiprogramming System and Time Sharing System?

Main difference between multiprogramming and time sharing is that multiprogramming is the effective
utilization of CPU time, by allowing several programs to use the CPU at the same time but time sharing is
the sharing of a computing facility by several users that want to use the same facility at the same time.
Each user on a time sharing system gets her own terminal and gets the feeling that she is using the CPU
alone. Actually, time sharing systems use the concept of multiprogramming to share the CPU time
between multiple users at the same time.

What are the services of Operating System?

An Operating System provides services to both the users and to the programs.

 It provides programs an environment to execute.


 It provides users the services to execute the programs in a convenient manner.
Following are a few common services provided by an operating system −

 Program execution
 I/O operations
 File System manipulation
 Communication
 Error Detection
 Resource Allocation
 Protection
Program execution
Operating systems handle many kinds of activities from user programs to system programs like
printer spooler, name servers, file server, etc. Each of these activities is encapsulated as a
process.
A process includes the complete execution context (code to execute, data to manipulate,
registers, OS resources in use). Following are the major activities of an operating system with
respect to program management −

 Loads a program into memory.


 Executes the program.
 Handles program's execution.
 Provides a mechanism for process synchronization.
 Provides a mechanism for process communication.
 Provides a mechanism for deadlock handling.
I/O Operation
An I/O subsystem comprises of I/O devices and their corresponding driver software. Drivers hide the
peculiarities of specific hardware devices from the users.
An Operating System manages the communication between user and device drivers.

 I/O operation means read or write operation with any file or any specific I/O device.
 Operating system provides the access to the required I/O device when required.
File system manipulation
A file represents a collection of related information. Computers can store files on the disk (secondary
storage), for long-term storage purpose. Examples of storage media include magnetic tape, magnetic disk
and optical disk drives like CD, DVD. Each of these media has its own properties like speed, capacity,
data transfer rate and data access methods.
A file system is normally organized into directories for easy navigation and usage. These directories may
contain files and other directions. Following are the major activities of an operating system with respect
to file management −

 Program needs to read a file or write a file.


 The operating system gives the permission to the program for operation on file.
 Permission varies from read-only, read-write, denied and so on.
 Operating System provides an interface to the user to create/delete files.
 Operating System provides an interface to the user to create/delete directories.
 Operating System provides an interface to create the backup of file system.
Communication
In case of distributed systems which are a collection of processors that do not share memory, peripheral
devices, or a clock, the operating system manages communications between all the processes. Multiple
processes communicate with one another through communication lines in the network.
The OS handles routing and connection strategies, and the problems of contention and security.
Following are the major activities of an operating system with respect to communication −

 Two processes often require data to be transferred between them


 Both the processes can be on one computer or on different computers, but are connected through
a computer network.
 Communication may be implemented by two methods, either by Shared Memory or by Message
Passing.
Error handling
Errors can occur anytime and anywhere. An error may occur in CPU, in I/O devices or in the memory
hardware. Following are the major activities of an operating system with respect to error handling −

 The OS constantly checks for possible errors.


 The OS takes an appropriate action to ensure correct and consistent computing.
Resource Management
In case of multi-user or multi-tasking environment, resources such as main memory, CPU cycles and
files storage are to be allocated to each user or job. Following are the major activities of an operating
system with respect to resource management −

 The OS manages all kinds of resources using schedulers.


 CPU scheduling algorithms are used for better utilization of CPU.
Protection
Considering a computer system having multiple users and concurrent execution of multiple processes,
the various processes must be protected from each other's activities.
Protection refers to a mechanism or a way to control the access of programs, processes, or users to the
resources defined by a computer system. Following are the major activities of an operating system with
respect to protection −

 The OS ensures that all access to system resources is controlled.


 The OS ensures that external I/O devices are protected from invalid access attempts.
 The OS provides authentication features for each user by means of passwords.
What are System Calls?

 System calls provide an interface between the process and the operating system.
 System calls allow user-level processes to request some services from the operating system which
process itself is not allowed to do.
 In handling the trap, the operating system will enter in the kernel mode, where it has access to
privileged instructions, and can perform the desired service on the behalf of user-level process.
 It is because of the critical nature of operations that the operating system itself does them every
time they are needed.
 For example, for I/O a process involves a system call telling the operating system to read or write
particular area and this request is satisfied by the operating system.

Types of System calls


 Process control
 File management
 Device management
 Information maintenance
 Communications
1) Process Control:
 A running program needs to be able to stop execution either normally or abnormally.
 When execution is stopped abnormally, often a dump of memory is taken and can be examined
with a debugger.
 Following are functions of process control:
i. end, abort
ii. load, execute
iii. create process, terminate process
iv. get process attributes, set process attributes
v. wait for time
vi. wait event, signal event
vii. allocate and free memory
2) File management :
 We first need to be able to create and delete files. Either system call requires the name of the file
and perhaps some of the file's attributes.
 Once the file is created, we need to open it and to use it. We may also read, write, or reposition.
Finally, we need to close the file, indicating that we are no longer using it.
 We may need these same sets of operations for directories if we have a directory structure for
organizing files in the file system.
 In addition, for either files or directories, we need to be able to determine the values of various
attributes and perhaps to reset them if necessary. File attributes include the file name, a file type,
protection codes, accounting information, and so on
Functions:
o create file, delete file
o open, close file
o read, write, reposition
o get and set file attributes
3) Device Management:
 A process may need several resources to execute - main memory, disk drives, access to files, and
so on. If the resources are available, they can be granted, and control can be returned to the user
process. Otherwise, the process will have to wait until sufficient resources are available.
 The various resources controlled by the OS can be thought of as devices. Some of these devices
are physical devices (for example, tapes), while others can be thought of as abstract or virtual
devices (for example, files).
 Once the device has been requested (and allocated to us), we can read, write, and (possibly)
reposition the device, just as we can with files.
 In fact, the similarity between I/O devices and files is so great that many OSs, including UNIX,
merge the two into a combined file-device structure.
 A set of system calls is used on files and devices. Sometimes, 1/0 devices are identified by special
file names, directory placement, or file attributes.
Functions:
o request device, release device
o read, write, reposition
o get device attributes, set device attributes
o logically attach or detach devices

4) Information Maintenance
 Many system calls exist simply for the purpose of transferring information between the user
program and the OS. For example, most systems have a system call to return the current time and
date.
 Other system calls may return information about the system, such as the number of current users,
the version number of the OS, the amount of free memory or disk space, and so on.
 In addition, the OS keeps information about all its processes, and system calls are used to access
this information. Generally, calls are also used to reset the process information.
Functions:
 get time or date, set time or date
 get system data, set system data
 get and set process, file, or device attributes
5) Communication
 There are two common models of interprocess communication: the message-passing model and
the shared-memory model. In the message-passing model, the communicating processes
exchange messages with one another to transfer information.
 In the shared-memory model, processes use shared memory creates and shared memory attaches
system calls to create and gain access to regions of memory owned by other processes.
 Recall that, normally, the OS tries to prevent one process from accessing another process's
memory. Shared memory requires that two or more processes agree to remove this restriction.
They can then exchange information by reading and writing data in the shared areas.
 Message passing is useful for exchanging smaller amounts of data, because no conflicts need be
avoided. It is also easier to implement than is shared memory for intercomputer communication.
 Shared memory allows maximum speed and convenience of communication, since it can be done
at memory speeds when it takes place within a computer. Problems exist, however, in the areas of
protection and synchronization between the processes sharing memory.
Functions:
o create, delete communication connection
o send, receive messages
o transfer status information
o Attach and Detach remote devices

What are the System Programs?


The system program serves as a part of the operating system. It traditionally lies between the user
interface and the system calls. System programs provide an environment where programs can be
developed and executed. In the simplest sense, system programs also provide a bridge between the user
interface and system calls.

In the above image, system programs as well as application programs form a bridge between the user
interface and the system calls.

Types of System Programs:


System programs can be divided into seven parts. These are given as follows:

1) Status Information
The status information system programs provide required data on the current or past status of the
system. This may include the system date, system time, available memory in system, disk space,
logged in users etc.
2) Communications
These system programs are needed for system communications such as web browsers. Web
browsers allow systems to communicate and access information from the network as required.
3) File Manipulation
These system programs are used to manipulate system files. This can be done using various
commands like create, delete, copy, rename, print etc. These commands can create files, delete
files, copy the contents of one file into another, rename files, print them etc.
4) Program Loading and Execution
The system programs that deal with program loading and execution make sure that programs can
be loaded into memory and executed correctly. Loaders and Linkers are a prime example of this
type of system programs.
5) File Modification
System programs that are used for file modification basically change the data in the file or
modify it in some other way. Text editors are a big example of file modification system
programs.
6) Application Programs
Application programs can perform a wide range of services as per the needs of the users. These
include programs for database systems, word processors, plotting tools, spreadsheets, games,
scientific applications etc.
7) Programming Language Support
These system programs provide additional support features for different programming languages.
Some examples of these are compilers, debuggers etc. These compile a program and make sure it
is error free respectively.
Some examples of system programs in O.S. are –
 Ubuntu
 Linux
 Unix
 Android
 Anti-virus
 Disk formatting
 Computer language translators

What is the Difference Between System Program and Application Program?

NO SYSTEM SOFTWARE APPLICATION SOFTWARE

1 System Software maintain the system resources and give the

. path for application software to run. Application software is built for specific tasks.

2 While high level languages are used to write the

. Low level languages are used to write the system software. application software.

. Its a general purpose software. While its a specific purpose software.

4 While without application software system always

. Without system software, system can’t run. runs.


5 System software runs when system is turned on and stop when While application software runs as per the user’s

. system is turned off. request.

6 Example of application software are Photoshop,

. Example of system software are operating system, etc. VLC player etc.

7 System Software programming is complex than application Application software programming is simpler as

. software. comparison to system software.

You might also like