UNIT 1 Operating System Overview
UNIT 1 Operating System Overview
UNIT 1 Operating System Overview
com
UNIT 1
Introduction
An operating system (OS) is a set of programs that
control the execution of application programs and act as an
intermediary between a user of a computer and the
computer hardware.
OS is software that manages the computer hardware as well
as providing an environment for application programs to run.
Examples of OS are: Windows, Windows/NT, OS/2 and
MacOS.
Introduction:
Computer Software can roughly be divided into two types:
a). Application Software: Which perform the actual
work the user wants.
b). System Software: Which manage the operation of
the computer itself.
The most fundamental system program is the operating
system, whose job is to control all the computer's resources
and provide a base upon which the application program can
be written.
Operating system acts as an intermediary between a user of a
computer and the computer hardware.
Introduction:
An operating system is a program that acts as an
interface between the user and the computer
hardware and controls the execution of all kinds
of programs.
OS is a resource allocator
Manages all resources
Decides between conflicting requests for efficient and fair
resource use
OS is a control program
Controls execution of programs to prevent errors and improper
use of the computer
Memory Management
Memory management refers to management of Primary Memory or
Main Memory.
Main memory provides a fast storage that can be accessed directly by
the CPU.
For a program to be executed, it must be in the main memory.
An Operating System does the following activities for memory
management:
Keeps tracks of primary memory, i.e., what part of it are in use by
whom, what part are not in use.
In multiprogramming, the OS decides which process will get memory
when and how much.
Allocates the memory when a process requests it to do so.
De-allocates the memory when a process no longer needs it or has been
terminated.
Processor Management
In multiprogramming environment, the OS decides which
process gets the processor when and for how much time.
This function is called process scheduling.
An Operating System does the following activities for
processor management:
Keeps tracks of processor and status of process.
Allocates the processor (CPU) to a process.
De-allocates processor when a process is no longer required.
Device Management
An Operating System manages device communication via
their respective drivers.
It does the following activities for device
management:
Keeps tracks of all devices.
Decides which process gets the device when and for how
much time.
Allocates the device in the most efficient way.
De-allocates devices.
File Management
A file is normally organized into directories for easy
navigation and usage.
These directories may contain files and other directories.
An Operating System does the following activities for
file management:
Keeps track of information, location, uses, status etc.
Decides who gets the resources.
Allocates the resources.
De-allocates the resources.
Computer System
Computer System
A computer system can be divided into four components: the
hardware, the operating system, the application programs and the
users. The abstract view of system components is shown in figure1.
1. Hardware: such as CPU, memory and I/O devices.
2. Operating system: provides the means of proper use of the
hardware in the operations of the computer system, it is similar to
government.
3. Application programs: solve the computing problems of the
user, such as : compilers, database systems and web browsers.
4. Users: peoples, machine, or other computer.
Figure 2
15 Nipun Thapa (OS/Unit 2)
https://genuinenotes.com
Phase 1: 1955-1970
Computers are expensive; people are cheap
Make more efficient use of the computer: move the person
away from the machine.
Time of batch processing.
OS becomes a batch monitor:
a program that loads a user’s job, runs it, and then moves on to
the next.
More efficient use of hardware, but increasingly difficult to
debug!
Phase 1 Technology
Buffering and interrupt handling is done by OS.
Spool(simultaneous peripheral operations online) jobs onto ―high
speed‖ drums (cards are slow)
Problems
CPU Utilization is low (one job at a time).
Short jobs wait if they get stuck behind longer jobs.
Solutions
Multiprogramming: Many programs can share the system.
Scheduling: Let short jobs finish quickly
OS/360: first OS designed for a family of computers; one
operating system designed to run from smallest to largest
machines.
Phase 1 Disasters
Operating systems didn’t really work!
OS/360 was introduced in 1963; worked in 1968.
Systems were enormously complicated.
They were written in assembly code.
Phase 2: 1970-1980
Interactive timesharing: let many users use the same machine at
once.
Terminals are cheap: give everyone one
CTSS(compatible time sharing system):
Developed at MIT.
One of the first timesharing systems.
Pioneered much of the work in scheduling.
Motivated MULTICS.
MULTICS:
Joint development by MIT, Bell Labs
Building it was more difficult than expected.
Phase 2: UNIX
Ken Thompson and Dennis Ritchie built a system.
Originally in assembly language. Rewritten by Ritchie and
Thompson in C.
New idea: portable operating system!
Universities obtained code for experimentation.
UNIX becomes a commercial operating system.
Important ideas popularized by UNIX
OS written in a high-level language.
OS is portable across hardware platforms.
Phase 3: 1980-1990
Computers are cheap; people are expensive.
CP/M first personal computer operating system.
Approached Bill Gates (Microsoft) to see if they could build
one.
Gates bought 86-DOS, and created MS-DOS.
Phase 3 Technologies
Personal computers
The Apple II
The IBM PC
The Macintosh
Business applications grow around the industry
Word processors
Spreadsheets
Databases
Serial Processing:
Early computers from 1940s to 1950s.
This mode of operation is turned as serial processing ,reflecting
the fact that users access the computer in series.
The programmer interacted directly with the computer hardware.
These machine are called bare machine as they don't have OS.
Every computer system is programmed in its machine language.
Uses Punch Card, paper tapes.
These system presented two major problems.
1. Scheduling
2. Set up time:
Serial Processing:..
Scheduling:
A user may sign up for an hour but finishes his job in 45 minutes.
This would result in wasted computer time, also the user might run into the
problem not finish his job in allotted time.
Set up time:
A single program involves:
Loading compiler and source program in memory
Saving the compiled program (object code)
Loading and linking together object program and common function
Each of these steps involves the mounting or dismounting tapes, setting up
punch cards.
If an error occur, user had to go the beginning of the set up sequence.
Thus, a considerable amount of time is spent in setting up the program to run.
Real-time Systems
Real-time systems are used when there are rigid time
requirements on the operation of a processor or the flow of data.
Real-time systems can be used as a control device in a dedicated
application.
Real-time operating system has well-defined, fixed time
constraints otherwise system will fail.
Primary objective of Real Time Operating System is to provide
quick response time and thus to meet deadline.
User convenience and resource utilization are secondary concern
to these systems.
E.g., Scientific experiments, medical imaging systems, industrial
control systems, weapon systems, robots, and home-applicance
controllers.
1.Monolithic System
The components of monolithic operating system are organized haphazardly and
any module can call any other module without any reservation.
The operating system code runs in a privileged processor mode (referred to as
kernel mode), with access to system data and to the hardware;
Applications run in a non-privileged processor mode (called the user mode),
with a limited set of interfaces available and with limited access to system data.
The operating system is written as a collection of procedures, each of which can
call any of the other ones whenever it needs to.
This approach might well be subtitled "The Big Mess." The structure is that
there is no structure.
The monolithic operating system structure with separate user and kernel
processor mode is shown in Figure. Example Systems: CP/M and MS-
DOS
1.Monolithic System..
3. Virtual Machines:
Virtual machine is an illusion of a real machine.
It is created by a real machine operating system, which make a
single real machine appears to be several real machine.
The architecture of virtual machine is shown below.
The best example of virtual machine architecture is IBM 370
computer.
In this system each user can choose a different operating system.
Actually, virtual machine can run several operating systems at
once, each of them on its virtual machine.
Its multiprogramming shares the resource of a single machine in
different manner
3. Virtual Machines:…
Advantages:
The virtual-machine concept provides complete protection of
system resources since each virtual machine is isolated from all
other virtual machines. This isolation, however, permits no direct
sharing of resources.
A virtual-machine system is a perfect vehicle for operating-
systems research and development. System development is done
on the virtual machine, instead of on a physical machine and so
does not disrupt normal system operation.
Disadvantage:
The virtual machine concept is difficult to implement due to the
effort required to provide an exact duplicate to the underlying
machine
5. Microkernel
The new concepts in operating system design, microkernel,
is aimed at migrating traditional services of an operating
system out of the monolithic kernel into the user-level
process.
The idea is to divide the operating system task into several
processes, each of which implements a single set of services
- for example, I/O servers, memory server, process server,
threads interface system.
5. Microkernel..
Each server runs in user mode, provides services to the
requested client.
The client, which can be either another operating system
component or application program, requests a service by
sending a message to the server.
An OS kernel (or microkernel) running in kernel mode
delivers the message to the appropriate server;
The server performs the operation; and microkernel delivers
the results to the client in another message, as illustrated in
Figure of client server structure earlier.
6. Exo-kernel architecture
It is a further extension of the micro-kernel approach where
the kernel is devoid of functionality.
This means the request for file access by one process would
be passed by the kernel to the library that is directly
responsible for managing file system.
Comparison as:
-In monolithic everything is implemented in the kernel space
-In microkernel only the lower level operating system facilities
are implemented in the kernel
-In Exo-kernel nothing is implemented in kernel space.
System Call:
In computing, a system call is the mechanism used by an
application program requests a service from an operating system's
kernel.
This may include hardware related services (e.g. accessing the hard
disk), creating and executing new processes, and communicating
with integral kernel services (like scheduling).
System calls provide the interface between a process and the
operating system.
On Unix, Unix-like and other POSIX-compatible (Portable
operating system interface) operating systems, popular system
calls are open, read, write, close, wait, fork, exit, and kill.
Many of today's operating systems have hundreds of system calls.
For example, Linux has over 300 different calls.
1. Process Control:
Many system calls exist for the purpose of controlling
processes. These system calls include:
end, abort – A running program needs to be able to halt its
execution either normally (end) or abnormally (abort).
load, execute – A process or job executing one program may
want to load and execute another program.
create process, terminate process – A new job or process
is created when needed (create process) and terminated if it is
incorrect or no longer needed (terminate process).
get process attributes, set process attributes – To control
the execution of a job or process, it requires the ability to
determine (get process attributes) and reset (set process attributes) the
attributes of job or process, including the job’s priority, its
maximum allowable execution time, and so on.
1. Process Control:…
wait for time – Having created new jobs or processes, we
may need to wait for a certain amount of time to finish their
execution (wait time).
wait event, signal event – Having created new jobs or
processes, we may want to wait for a specific event to occur
(wait event). The jobs or processes should then signal when
that event has occurred (signal event).
allocate memory, free memory – A program needs
memory before it executes (allocate memory) and that memory
should be freed after its termination (free memory).
2. File Management:
Several system calls dealing with files are:
create file, delete file – We may want to create (create) and
delete (delete) files.
open file, close file – Once the file is created, we need to
open (open) it and to use it. Finally, we need to close (close) the file,
indicating that we are no longer using it.
read file, write file – We may also read (read), write (write)
the file after opening it.
get file attributes, set file attributes – We may also need to
determine (get file attribute) and reset (set file attribute) file
attributes if necessary. File attributes include the file name, file
type, and so on.
If we have directory structure for organizing files in the file
system, the same set of operations are needed for directories.
3. Device Management:
System calls dealing with devices include:
request device, release device – A running program must
first request the device (request) to ensure exclusive use of it. After
finished with the device, it must be released (release). These
functions are similar to the open and close system calls for files.
read, write – Once the device has been requested and
allocated, a process can read, write, the device, just as with
ordinary files.
get device attributes, set device attributes – A process
may also need to determine (get device attribute) and reset (set device
attribute) device attributes if necessary. File attributes include the
device name, device type, and so on.
4. Information Maintenance:
These system calls exist for the purpose of transferring information
between the user program and the operating system.
get time or date, set time or date – Most systems have
system calls to determine and reset system time or date.
get system data, set system data – These system calls
determine and reset 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 process, file, or device attributes – These system calls
determine attributes about all its processes, files and devices used
in the processes.
set process, file, or device attributes – These system calls
reset information about all its processes, files and devices used in
the processes.
5. Communications:
There are two common models of communication: message passing
model and shared memory model.
In the message-passing model, processes communicate by
exchanging information through an interprocess-communication facility
provided by the OS. The system calls associated with this model are:
get host id – Translates the host name into an equivalent identifier.
get process id – Translates the process name into an equivalent
identifier.
open and close or specific open connection and close
connection
– The above identifiers are passed to the general purpose open and close
system calls provided by the file system or to specific open connection
and close connection system calls.
5. Communications: ..
accept connection – The recipient process usually must give its
permission for communication to take place with an accept
connection call.
wait for connection – The processes that will be receiving
connections execute a wait for connection call and are awakened when
the connection is made.
read message and write message – The sending and receiving
processes exchange messages by read message and write message
system calls.
In the shared-memory model, processes communicate by using a
common memory. The system calls associated with this model are:
map memory – A process use this system call to gain access to
regions on memory owned by other processes.
read and write – They may then exchange information by reading
and writing data in these shared areas.
Shell:
A shell is a program that provides the traditional text only user interface for
Linux and other Unix operating system.
In computing, a shell is a piece of software that provides an interface for users
and provides access to the services of a kernel.
Its primary function is to read commands typed into a console or terminal
window and then execute it.
The term shell derives its name form the fact that it is an outer layer of the OS.
A shell is an interface between the user and the internal part of the operating
system.
A user is in shell(i.e interacting with the shell) as soon as the user has logged
into the system.
A shell is the most fundamental way that user can interact with the system and
the shell hides the detail of the underlying system from the user.
Example: Bourne Shell, Bash shell, Korn Shell, C shell
Kernel:
In computing, the kernel is the main component of most computer
operating systems;
It is a bridge between applications and the actual data processing done at
the hardware level.
The kernel's responsibilities include managing the system's resources
(the communication between hardware and software components).
It typically makes these facilities available to application processes
through inter-process communication mechanisms and system calls.
Monolithic kernels execute all the operating system code in the same
address space,
Microkernels run most of the operating system services in user space as
servers, aiming to improve maintainability and modularity of the
operating system.
Finished Unit 1