0% found this document useful (0 votes)
3 views39 pages

Unit - 1 Os

The document provides an overview of operating systems, detailing their components, functions, advantages, and disadvantages. It explains the roles of hardware, operating systems, system programs, and application programs, as well as various structures of operating systems such as simple, monolithic, layered, micro-kernel, and modular. Additionally, it discusses different types of operating systems, including batch, multi-programming, and multi-tasking systems.

Uploaded by

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

Unit - 1 Os

The document provides an overview of operating systems, detailing their components, functions, advantages, and disadvantages. It explains the roles of hardware, operating systems, system programs, and application programs, as well as various structures of operating systems such as simple, monolithic, layered, micro-kernel, and modular. Additionally, it discusses different types of operating systems, including batch, multi-programming, and multi-tasking systems.

Uploaded by

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

Operating system

Computer system architecture or structure


Computer system can be divided into four components
1. Har dwar e – provides basic computing
resources
CPU, memory, I/O devices, Operat ing system
Controls and coordinates use of hardware among various applications and users.
Application programs – define the ways in which the system
resources are used to solve the computing problems of the users Word
processors, compilers, web browsers, database systems, video gam

Four Components of a Computer System

2.Operating system:
It provides environment where we can execute programs.
It controls and co-ordinates use of hardware among various applications and
users.
3.System Program and application program
System program:

 It is the collection of components and art or designing of a given program.


 System program aims to produce software which provides services to the
computer hardware.
 System software that executes the application software. It helps in executing the
application software.
 These programs allow the application programmer to focus on application to be
develop without concerning about the internal details of the System.
 Examples: Assembler Microprocessor, Loader, Linker, Compiler

Application Program:

 These are the set of programs that view computer as a tool for solving a particular
problem.
 Application software is a software that are been used by the end user.
 Application programming is used to build application software which includes
software like notepad, Word Pad, calculator, web browser, Microsoft excel and
many more.
 It interacts with system software which in turn interacts and makes physical
hardware functional.
 Examples: Word Processing, Hotel Management System, Accounting Package etc.

System Program Application Program

1) It is the collection of components and art or 1) It is the set of programs that view computer as a tool
designing of a given program. for solving a particular problem.

2) Programming is done using assembly language 2) Application programming is used to build application
which interacts with hardware. software which includes software.

3) System software that executes the application 3) Application software is a software that are been used
software. by the end user.

4) System programming is used to write low level 4)Application Programming is used to write High level
instructions instructions
System Program Application Program

5)Examples:- Loader, Linker, Compiler 5) Examples:- Library management System calculator,


web browser

4.User:peoples,machines,othercomputers .

Advantages of Operating System :


 O/S gives the interface between the clients and equipment.
 O/S permits to User Friendly Graphic Interface for all clients since it gives
different menus, catches, symbols, and more for simple route.
 No necessary any specialized aptitudes for working GUI O/S.
 financially savvy.
 It has answerable for controlling and control of all PC capacities.
 These stages are agreeable for all projects.
 It permits best highlights, for example, “Attachment and play”, implies no need
any drivers for utilizing their gadgets like as mouse, console, and sky is limit from
there.
 O/S utilizes various procedures, for example, memory division, paging, and
trading. Working framework can deal with own memory with utilizing those
methods.
 Working System gives help to dealing with all information and yield gadgets of
PC framework.
 O/S helps change all projects into measure for executing directions, and it has
answerable for synchronizing of all cycle.
 Working System can likewise deal with a wide range of interferes.
 O/S actualizes a wide range of booking strategies, for example, first start things
out served, Round robin, Priority planning and briefest employment firs booking
and so forth for planning the all cycle in CPU for execution.
 It assists with crushing outer discontinuity.
 O/S has answerable for circulating all information over whole framework.
 O/S gives the authorization for requesting paging just as preaging.
 It has no needed to fracture.
 It assists with planning all pages in powerful way.
 O/S permits imparting one bit of information to numerous clients.
 It additionally can share various assets like as Printer, Fax and so on.
 O/S can be refreshed time by time with no problem.
 It gives the adaptable interface to introducing a wide range of games and
programming, and can run effectively them.
 Some O/S gives the insurance from perilous records and infection, for example,
Windows safeguard in Window O/S.
 Various O/S are accessible in open source, for example, Unix/Linux. Working
System can be run effectively on PC framework with no cost (Free).
Disadvantages of Operating System :
Here, we will spread the light on restriction (cons) of working frameworks.
 It has broadened memory access times, for example, page table query.
 Need improvement with utilizing TLB.
 Required protected page tables. Need more memory for memory board.
 Need inner fracture.
 Page Table Length Register (PTLR) needs to bound with virtual memory size.
 It required greater improvement in staggered page tables and variable page sizes.
 Obscure clients can be utilized your framework without your authorization.
 On the off chance that working framework get shortcoming, at that point your
information can be obliterated from O/S.
 It is exceptionally troublesome assignment for giving whole assurance from all
infections in light of fact that any danger can be embedded any time.

Features of Operating System (OS)

 Protected and supervisor mode.


 Allows disk access and file systems Device drivers Networking Security.
 Program Execution.
 Memory management Virtual Memory Multitasking.
 Handling I/O operations.
 Manipulation of the file system.
 Error Detection and handling.
 Resource allocation.
Functions of operating system:
Operating system performs the following functions:

Booting

Booting is a process of starting the computer operating system starts the computer to work. It checks the
computer and makes it ready to work.

Two types

1.Hard booting:power on the cpu manually.

2.soft booting :Restart the system through mouse :

Memory Management

It is also an important function of

operating system. The memory cannot be managed without operating system. Different programs and
data execute in memory at one time. if there is no operating system, the programs may mix with each
other. The system will not work properly.

Loading and Execution

A program is loaded in the memory before it can be executed. Operating system provides the facility to
load programs in memory easily and then execute it.

Data security

Data is an important part of computer system. The operating system protects the data stored on the
computer from illegal use, modification or deletion.

Disk Management

Operating system manages the disk space. It manages the stored files and folders in a proper way.

Process Management

CPU can perform one task at one time. if there are many tasks, operating system decides which task should
get the CPU.

Device Controlling

operating system also controls all devices attached to computer. The hardware devices are controlled with
the help of small software called device drivers..

Providing interface
It is used in order that user interface acts with a computer mutually. User interface controls how you input
data and instruction and how information is displayed on screen. The operating system offers two types of
the interface to the user:

Graphical-line interface: It interacts with of visual environment to communicate with the


computer. It uses windows, icons, menus and other graphical objects to issues commands.
Command-line interface:it provides an interface to communicate with the computer by typing
commands.

Operating system conceptual structure: OS has two parts shell and


kernel

Shell is interface between user and kernel and converts the high level instructions to low
level instruction and hand over to kernel.

Kernel is heart of computer which do operations of operating system and also protects
hardware .

If user wants to access any data it has to communicate with kernel to access the hardware

to perform execution.

A shell is a CLI (command-line interpreter). A kernel is a type of low-level program that


has its interfacing with the hardware on top of which all the applications run (disks,
RAM, CPU, etc.).

main difference between kernel and shell is that the kernel is the core of the operating
system that controls all the tasks of the system while the shell is the interface that
allows the users to communicate with the kernel. Unix is an operating system.
Different approaches or Structures of Operating
System
Operating system can be implemented with the help of various structures. The structure
of the OS depends mainly on how the various common components of the operating
system are interconnected and melded into the kernel. Depending on this we have
following structures of the operating system:

1.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 operating system. In MS-DOS application programs are able to
access the basic I/O routines. These types of operating system cause the entire system to
crash if one of the user programs fails.
Diagram of the structure of MS-DOS is shown below.

Fig:Simple structure
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 exists between modules.
 It does not enforce data hiding in the operating system.
2.Monolithical structures:

The monolithic operating system is a very basic operating system in which file
management, memory management, device management, and process management are
directly controlled within the kernel. The kernel can access all the resources present in the
system. In monolithic systems, each component of the operating system is contained
within the kernel. Operating systems that use monolithic architecture were first time used
in the 1970s.

The monolithic operating system is also known as the monolithic kernel. This is an old
operating system used to perform small tasks like batch processing and time-sharing
tasks in banks. The monolithic kernel acts as a virtual machine that controls all hardware
parts.

It is different from a microkernel, which has limited tasks. A microkernel is divided into
two parts, kernel space, and user space. Both parts communicate with each other through
IPC (Inter-process communication). Microkernel's advantage is that if one server fails,
then the other server takes control of it.

-Monolithic kernel
A monolithic kernel is an operating system architecture where the entire operating system
is working in kernel space. The monolithic model differs from other operating system
architectures, such as the microkernel architecture, in that it alone defines a high-level
virtual interface over computer hardware.

A set of primitives or system calls implement all operating system services such as
process management, concurrency, and memory management. Device drivers can be
added to the kernel as modules.

Advantages of Monolithic Kernel

Here are the following advantages of a monolithic kernel, such as:

o 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.

o A process runs completely in single address space in the monolithic kernel.

o The monolithic kernel is a static single binary file.

Disadvantages of Monolithic Kernel

Here are some disadvantages of the monolithic kernel, such as:

o If any service fails in the monolithic kernel, it leads to the failure of the entire

system.

o The entire operating system needs to be modified by the user to add any new

service.

3.Layered structure:
An OS can be broken into pieces and retain much more control on system. In this
structure the OS is broken into 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.
Advantages of Layered structure:
 Layering makes it easier to enhance the operating system as implementation of a
layer can be changed easily without affecting the other layers.
 It is very easy to perform debugging and system verification.
Disadvantages of Layered structure:
 In this structure the application performance is degraded as compared to simple
structure.
 It requires careful planning for designing the layers as higher layers use the
functionalities of only the lower layers.

4.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 result 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 rest of the operating system remains untouched. Mac OS is an example
of this type of OS.
Advantages of Micro-kernel structure:
 It makes the operating system portable to various platforms.
 As microkernels are small so these can be tested effectively.
Disadvantages of Micro-kernel structure:
 Increased level of inter module communication degrades system performance.

5.Modular structure or approach:


It is considered as the best approach for an OS.
It involves designing of a modular kernel.
The kernel has only set of core components and other services are added as
dynamically loadable modules to the kernel either during run time or boot time.
It resembles layered structure due to the fact that each kernel has defined and
protected interfaces but it is more flexible than the layered structure as a module can call
any other module.
For example Solaris OS is organized as shown in the figure.
Types of Operating Systems
1)Batch operating system

2)Multi programming operating system

3)Multi –tasking /Time shared system operating system

4)Personal computer operating system

5)Parallel/Multiple-processing operating system

6)DISTRIBUTED operating sytem

6)RTOS(REAL TIME OPERATING SYSTEM)

1.Batch Operating System –


This type of operating system does not interact with the computer directly. There is an
operator which takes similar jobs having the same requirement and group them into
batches. It is the responsibility of the operator to sort jobs with similar needs.

Job is –“collection of progreme,I/O data ,control instruction”.

Jobs-write the code in c language whichn is offline device(punch card)submit to


computer operaterBatch (similar kinds of jobs together)execute.
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


 Batch systems are hard to debug
 It is sometimes costly
 The other jobs will have to wait for an unknown time if any job fails
Examples of Batch based Operating System: Payroll System, Bank Statements, taking
attendance one after another.
2.Multi programming operating system:
3. Multi -Tasking operating system(Time-Sharing Operating
Systems ):-
Each task is given some time to execute so that all the tasks work smoothly. Each user
gets the time of CPU as they use a single system.
These systems are also known as Multitasking Systems. The task can be from a single
user or different users also. The time that each task gets to execute is called quantum.
After this time interval is over OS switches over to the next task.

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
Examples of Time-Sharing OSs are: Multics, Unix, etc.
Difference between Multiprogramming and Multi-tasking
S.no Multiprogramming Multi-tasking

Both of these concepts are for single


1. CPU. Both of these concepts are for single CPU.

Concept of Context Switching is Concept of Context Switching and Time


2. used. Sharing is used.

The processor is typically used in time


In multiprogrammed system, the sharing mode. Switching happens when
operating system simply switches either allowed time expires or where there
to, and executes, another job when other reason for current process needs to
3. current job needs to wait. wait (example process needs to do IO).

In multi-tasking also increases CPU


Multi-programming increases CPU utilization, it also increases
4. utilization by organising jobs . responsiveness.

The idea is to further extend the CPU


The idea is to reduce the CPU idle Utilization concept by increasing
5. time for as long as possible. responsiveness Time Sharing.

4.Personal Computer Operating System

Personal computer operating system provides a good interface to a single user.

Personal computer operating systems are widely used for word processing, spreadsheets
and Internet access.

Personal computer operating system are made only for personal.

You can say that your laptops, computer systems, tablets etc. are your personal computers
and the operating system such as windows 7, windows 10, android, etc. are your personal
computer operating system.

And you can use your personal computer operating system for your personal purposes,
for example, to chatting with your friends using some social media sites, reading some
articles from internet, making some projects through microsoft powerpoint or any other,
designing your website, programming something, watching some videos and movies,
listening to some songs and many more.
5.Parallel/Multiple-processing operating system:
A multiprocessing operating system (OS) is one in which two or more central
processing units (CPUs) control the functions of the computer. Each CPU contains a
copy of the OS, and these copies communicate with one another to coordinate operations.

zmultiple programs (more than one program) are executed on different processors
at the same time. This type of processing is known as multiprocessing. Some operating
systems have features of multiprocessing. UNIX is an example of multiprocessing
operating system. Some versions of Microsoft Windows also support multiprocessing.

Multiprocessor system is also known as parallel system. Mostly the processors of


multiprocessor system share the common system bus, clock, memory and peripheral
devices. This system is very fast in data processing.

2 types of multiprocessing operating system


1)Symmetric multiprocessors:
2)Asymmetric multiprocessor

i)Asymmetric Multiprocessing System(AMS):

The multiprocessing system, in which each processor is assigned a specific task, is known
as Asymmetric Multiprocessing System. For example, one processor is dedicated for
handling user's requests, one processor is dedicated for running application program, and
one processor is dedicated for running image processing and so on. In this system, one
processor works as master processor, while other processors work as slave processors.
The master processor controls the operations of system. It also schedules and distributes
tasks among the slave processors. The slave processors perform the predefined tasks.
ii)Symmetric Multiprocessing System(SMP):

The multiprocessing system, in which multiple processors work together on the same
task, is

known as Symmetric Multiprocessing System. In this system, each processor can perform
all types of tasks. All processors are treated equally and no master-slave relationship
exists between the processors.

For example, different processors in the system can communicate with each other.
Similarly, anI/O can be processed on any processor. However, I/O must be controlled to
ensure that the data reaches the appropriate processor. Because all the processors share
the same memory, so the input data given to the processors and their results must be
separately controlled. Today all modern operating systems including Windows and Linux
provide support for SMP.

It must be noted that in the same computer system, the asymmetric


multiprocessing andsymmetric multiprocessing technique can be used through different
operating systems.

Advantages :
1)Max throughput
2)More Reliable system
3)Fast processing
4)Efficiency improved
5)More economic system

6. Distributed Operating System –


These types of the operating system is a recent advancement in the world of
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.
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

Disadvantages of Distributed Operating System:

 Failure of the main network will stop the entire communication


 To establish distributed systems the language which is used are not well defined yet
 These types of systems are not readily available as they are very expensive. Not only
that the underlying software is highly complex and not understood well yet

Examples of Distributed Operating System are- LOCUS, etc.


7. Real-Time Operating System –
These types of OSs serve real-time systems. The time interval required to process and
respond to inputs is very small. This time interval is called response time.
Real-time systems are used when there are time requirements that are very strict like
missile systems, air traffic control systems, robots, etc.
Two types of Real-Time Operating System which are as follows:

 Hard Real-Time Systems:


These OSs are meant for applications where time constraints are very strict and even
the shortest possible delay is not acceptable. These systems are built for saving life
like automatic parachutes or airbags which are required to be readily available in
case of any accident. Virtual memory is rarely found in these systems.

 Soft Real-Time Systems:


These OSs are for applications where for time-constraint is less strict.

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.
 Complex Algorithms: The algorithms are very complex and difficult for the designer
to write on.
 Device driver and interrupt signals: It needs specific device drivers and interrupts
signals to respond earliest to interrupts.
 Thread Priority: It is not good to set thread priority as these systems are very less
prone to switching tasks.
Examples of Real-Time Operating Systems are: Scientific experiments, medical
imaging systems, industrial control systems, weapon systems, robots, air traffic control
systems, etc.

System components of operating system

There are various types of operating system components:

1. Process Management
2. File Management
3. Network Management
4. Main Memory Management
5. Secondary Storage Management
6. I/O Device Management
7. Security Management
8. Command Interpreter System

1. Process Management
The term ‘Process Management’ means a mechanism which is used to handle
multiple processes that are running in the operating system concurrently. Each
software application program contains processes that are associated with the
software application program when they are running.
For example: - If we use Google Chrome browserthen a process also run for the
browser program. In the operating system, there are various processes which also
run and perform several functions.
With the help of the process management, all the processes are managed and kept
running effectively.
Functions of Process Management

There are various types of process management functions:

 Synchronization Process
 Suspension and Resumption.
 Communication Process
 Process Creation and Deletion.

2. File Management
. In a distributed system, each processor has its separate memory, and the
communication between A file is defined as a set of correlated information and it is
defined by the creator of the file. Mostly files represent data, source and object
forms, and programs. Data files can be of any type like alphabetic, numeric, and
alphanumeric.
Functions of File Management
There are various functions of file management:

 Mapping Files onto secondary storage.


 With the help of a file management we can create and delete a file.
 It offers the facility of directory creation and deletion.
 Helps in backup files on to secondary memory.
 File and directory manipulation.

3. Network Management
We can understand from the network management that it is the process of
managing and administering the computer network. Network management
comprises fault analysis, maintaining the quality of service, provisioning of
networks, and performance management.
The collection of a computer/processors is known as a distributed system.
A distributed system is one which does not share its memorythe processors takes place
with the help of different communication lines such as telephone lines, fiber optics, etc.
In the network, with the help of the computer network, computers are connected, and it is
configured in various ways. Network management provides the facility of network
connection, whether it is fully or partially connected network. And it helps to design
routing and connection strategies, which helps in overcoming the issues of security and
connection.

4. Main Memory Management


Main memory is defined as a vast array of bytes or words; each contains its own
memory address. With the help of a series of reads or writes of a particular memory
address, the memory management process is performed.
Functions of Main Memory Management
There are various functions of main memory management:

 It helps in memory allocation when a process demand or requests.


 With the help of main memory management, we can preserve track of the primary
memory.
 Main memory management also helps in memory deallocation process that no
longer need the memory or if the process is terminated.
 Main memory management is also supported in a multiprogramming system
where the operating system has to decide which process will get the memory and
how much.
 It helps to specify which part of the memory is in use and which part of the
memory is not in use.

5. Secondary Storage Management


The main task performed by the operating system is to execute the programs. And along
with the data, these programs are helpful to access the programs, which are present in the
main memory at the time of execution.
The memory size is too small, so we cannot store all the programs and data in the
memory permanently. So, the computer system provides the facility of secondary storage.
In today’s scenario, hard drives/SSD are used in most of the computer system as the
primary memory for both data as well as programs.
Although we also use secondary storage management with various storage devices such
as CD/DVD drives and USB flash drive.
There are various programs such as compilers, assemblers, etc. that are stored on a disk
till the program is loaded into the memory, and then for processing, programs use the
disk as a source and the destination.
functions of Secondary Storage Management
There are various functions of secondary storage management:

 Secondary storage helps in Disk Scheduling.


 Storage Allocation
 Free Space Management

6. I/O Device Management


The operating system is responsible to hide the details of the hardware devices from the
user.
Functions of the I/O Management
There are various functions of I/O management:

 It offers a general device driver code.


 The I/O device management provides a buffer caching system.
 The I/O device management provides the drivers for a specific hardware device.

7. Security Management
In an operating system, there are several processes that are required to be secured from
different activities. For this purpose, there are different types of procedures we use, which
ensures that the processes that you want to operate for the hardware resources such as
memory CPU, files, etc. must have appropriate authorization from the operating system.
For Example: With the help of the memory addressing hardware, we can ensure that a
process cannot execute outside its own address space or vice versa. Time confirms that
there is no process that has control over the CPU without leaving it.
Finally, to protect the process, there is no process that can do its own Input/Output. And
it helps to maintain the integrity of different peripheral devices.

8. Command Interpreter System


Command interpreter is an essential component of the operating system. It works as a
primary interface between the user and the system.
Operating system services:

One set of operating-system services provides functions that are helpful to the user Communications –
Processes may exchange information, on the same computer or between computers over a network
Communications may be via shared memory or through message passing (packets movedby the OS)

1)Error detection – OS needs to be constantly aware of possible errors May occur in the CPU and memory
hardware, in I/O devices, in user program For each type of error, OS should take the appropriateaction to
ensure correct and consistent computing Debugging facilities can greatly enhance the user’s and
programmer’s abilities to efficiently use the system

Another set of OS functions exists for ensuring the efficient operation of the system itself via resource
sharing

2)Resource allocation - When multiple users or multiple jobs running concurrently, resources mustbe
allocated to each of them

Many types of resources - Some (such as CPU cycles, main memory, and file storage) may have special
allocation code, others (such as I/O devices) may have general request and release code

3)Accounting - To keep track of which users use how much and what kinds of computer resource

4)Protection and security - The owners of information stored in a multiuser or networked computer
system may want to control use of that information, concurrent processes should not interfere with each
other

-Protection involves ensuring that all access to system resources is controlled

-Security of the system from outsiders requires user authentication, extends to defending external I/O
devices from invalid access attempts

If a system is to be protected and secure, precautions must be instituted throughout it. A chain is only as
strong as its weakest link.
User Operating System Interface - CLI

Command Line Interface (CLI) or command interpreter allows direct command entry

Sometimes implemented in kernel, sometimes by systems program Sometimes multiple flavors


implemented – shells

Primarily fetches a command from user and executes it

User Operating System Interface - GUI

User-friendly desktop metaphor interfaceUsually mouse, keyboard, and monitorIcons represent files,
programs, actions, etc

Various mouse buttons over objects in the interface cause various actions (provide information, options,
execute function, open directory (known as a folder)

Invented at Xerox PARC

Many systems now include both CLI and GUI interfaces Microsoft Windows is GUI with CLI “command”
shell

Apple Mac OS X as “Aqua” GUI interface with UNIX kernel underneath and shells available Solaris is CLI
with optional GUI interfaces (Java Desktop, KDE)

Introduction to System Calls

To understand system calls, first one needs to understand the difference between kernel
mode
and user mode of a CPU. Every modern operating system supports these two modes.

Modes supported by the operating system


Kernel Mode

 When CPU is in kernel mode, the code being executed can access any memory
address and any hardware resource.
 Hence kernel mode is a very privileged and powerful mode.
 If a program crashes in kernel mode, the entire system will be halted.

User Mode

 When CPU is in user mode, the programs don't have direct access to memory
and hardware resources.
 In user mode, if any program crashes, only that particular program is halted.
 That means the system will be in a safe state even if a program in user mode

Hence, most programs in an OS run in user mode.

There exist two modes of operations in OS. They are:


User mode: User applications get executed in user mode. The mode bit = 1
Kernel mode: Operating Systems functions get executed in kernel mode. The mode
bit
When user application executes in user mode and needs support from OS, a system call
is generated. The system call enters into kernel mode by setting mode bit = 0. It get
executed in kernel and results are return back to the user application by changing the
mode bit = 1.

System Call

When a program in user mode requires access to RAM or a hardware resource, it must
ask the kernel to provide access to that resource. This is done via something called a
system call.

When a program makes a system call, the mode is switched from user mode to kernel
mode. This is called a context switch.

Then the kernel provides the resource which the program requested. After that, another
context switch happens which results in change of mode from kernel mode back to user
mode.
Programming interface to the services provided by the OS Typically written in a high-level
language (C or C++)

Mostly accessed by programs via a high-level Application Program Interface (API) rather than
direct system call usenThree most common APIs are Win32 API for Windows, POSIX API for
POSIX- based systems (including virtually all versions of UNIX, Linux, and Mac OS X), and Java
API for the Java virtual machine (JVM)

Why use APIs rather than system calls?(Note that the system-call names used throughout this text
are generic)

Example of System Calls


Generally, system calls are made by the user level programs in the following situations:

Creating, opening, closing and deleting files in the file system.


Creating and managing new processes.
Creating a connection in the network, sending and receiving packets.
Requesting access to a hardware device, like a mouse or a printer.

The system calls acts as an interface between a user process and the Operating system
kernel. When a process in user mode needs to access a resource, a request is sent to the
kernel.

System Call Parameter Passing

Often, more information is required than simply identity of desired systemcall Exact type and
amount of information vary according to OS and call Three general methods used to pass
parameters to the

OS Simplest: pass the parameters in registers

In some cases, may be more parameters than registers

Parameters stored in a block, or table, in memory, and address of block passed as a parameter
in a register

This approach taken by Linux and Solaris

Parameters placed, or pushed, onto the stack by the program and popped off the stack by the
operatingsystem

Block and stack methods do not limit the number or length of parameters being
passed Parameter Passing via Table
TYPES OF SYSTEM CALLS.

There are mainly five types of system calls. These are explained in detail as
follow
1)Process Control: These system calls deal with process management and control.

2)File Management: These system calls deals with file manipulation and
management.

3)Device Management: These system calls deals with device manipulation and
management.
4)Information Maintenance: These system calls handle information and its
transfer between the operating system and the user program.
5)Communication: These system calls are useful for inter-process communication.

-Process control

A running needs to halt its execution either normally or abnormally.

If a system call is made to terminate the running program, a dump of memory is


sometimestaken and an error message generated which can be diagnosed by a debugger

 end, abort
 load, execute
 create process, terminate process
 get process attributes, set process attributes
 wait for time
 wait event, signal event
-File management

OS provides an API to make these system calls for managing files

 create file, delete file


 open, close file
 read, write, reposition
 get and set file attributes
-Device management

Process requires several resources to execute, if these resources are available, they will be
granted and control retuned to user process. Some are physical such as video card and
other such as file. User program request the device and release when finished

 request device, release device


 read, write, reposition
 get device attributes, set device attributes
 logically attach or detach devices

-Information maintenance

System calls exist purely for transferring information between the user program and OS.
It can return information about the system, such as the number of current users, the
version number of the operating system, the amount of free memory or disk space and so
on.

 get time or date, set time or date


 get system data, set system data
 get and set process, file, or device attributes

-Communications

Two common models of communication

Message-passing model, information is exchanged through an inter process-


communication facility provided by the OS.
Shared-memory model, processes use map memory system calls to gain access to regions
ofmemory owned by other processes.

 create, delete communication connection


 send, receive messages
 transfer status information
 attach and detach remote devices

Types of System calls Windows Unix


CreateProcess( ) fork( )
Process Control ExitProcess( ) exit( )
WaitForSingleObject wait( )
()
CreateFile( ) open( )
File Manipulation ReadFile( ) read( )
WriteFile( ) write(
CloseHandle( ) close(
) )
SetConsoleMode( ioctl( )
Device Manipulation ) ReadConsole( ) read( )
WriteConsole( ) write(
)
GetCurrentProcessID getpid(
Information Maintenance ( ) SetTimer( ) ) alarm(
Sleep( ) ) sleep(
)
CreatePipe( ) pipe( )
Communication CreateFileMapping shmget( )
() mmap( )
MapViewOfFile()

You might also like