Unit 1 Operating System
Unit 1 Operating System
parallel processing is used in the fields like artificial intelligence and expert system,
image processing, weather forecasting etc.
In a multiprocessor system, the dynamically sharing of resources among the various
processors may cause therefore, a potential bottleneck. There are three main sources of
contention that can be found in a multiprocessor operating system:
P
avoiding sharing altogether.
AP
1.8.2.2 Shared data:
The continuous accesses to the shared data items by multiple processors (with one
or more of them with data write) are serialized by the cache coherence protocol.
Even in a moderate-scale system, serialization delays can have significant impact
on the system performance.
R
In addition, bursts of cache coherence traffic saturate the memory bus or the
interconnection network, which also slows down the entire system. This form of
CO
contention can be eliminated by either avoiding sharing or, when this is not
possible, by using replication techniques to reduce the rate of write accesses to the
shared data.
U
This form of contention arises when unrelated data items used by different
processors are located next to each other in the memory and, therefore, share a
single cache line: The effect of false sharing is the same as that of regular sharing
bouncing of the cache line among several processors. Fortunately, once it is
identified, false sharing can be easily eliminated by setting the memory layout of
non-shared data.
1.9 OPERATING SYSTEM OVERVIEW
1.9.1 Objectives and Functions
1.9.2 Functions
Usage
Computer system
Control
Support
P
Usage
AP
Users of a computer system:
Programs - use memory, use CPU time, use I/O devices
Human users
Programmers - use program development tools such as debuggers, editors end
R
users - use application programs, e.g. Internet explorer
Computer system
CO
hardware + software
OS is a part of the computer software, it is a program. It is a very special program, that is
the first to be executed when the computer is switched on, and is supposed to control and
support the execution of other programs and the overall usage of the computer system.
U
Control
The operating system controls the usage of the computer resources - hardware devices
and software utilities. We can think of an operating system as a Resource Manager. Here
ST
Processors,
Main memory,
Secondary Memory,
Peripheral devices,
Information.
Support
The operating system provides a number of services to assist the users of the
computer system:
Problems
P
Setup Time- Setup included loading the compiler, source program, saving
AP
compiled program, and loading and linking. If an error occurred - start over.
Jobs were submitted on cards or tape to an operator who batches jobs together
R
sequentially. The program that controls the execution of the jobs was called monitor - a simple
version of an operating system. The interface to the monitor was accomplished through Job
CO
Control Language (JCL). For example, a JCL request could be to run the compiler for a
particular programming language, then to link and load the program, then to run the user
program.
Hardware features:
U
Memory protection: do not allow the memory area containing the monitor to be altered
Problems:
Bad utilization of CPU time - the processor stays idle while I/O devices are in use.
More than one program resides in the main memory. While a program A uses an I/O device the
processor does not stay idle, instead it runs another program B.
P
New features:
AP
R
Memory management - to have several jobs ready to run, they must be kept in main
memory
CO
Time-sharing systems: Several (human) users use the computer system interactively.
ST
Characteristics:
1. Program execution:
2. I/O operations:
A running program may require I/O. This I/O may involve a file or an I/O device.
3. File-system manipulation:
The program needs to read, write, create and delete files.
4. Communications :
In many circumstances, one process needs to exchange information with another
process. Such communication can occur in two major ways. The first takes place
between processes that are executing on the same computer; the second takes place
P
between processes that are executing on different computer systems that are tied
together by a computer network.
AP
5. Error detection:
The operating system constantly needs to be aware of possible errors. Errors may
occur in the CPU and memory hardware (such as a memory error or a power failure), in
I/O devices (such as a parity error on tape, a connection failure on a network, or lack of
paper in the printer), and in the user program (such as an arithmetic overflow, an attempt
R
to access an illegal memory location, or a too-great use of CPU time). For each type of
error, the operating system should take the appropriate action to ensure correct and
consistent computing.
CO
6. Resource allocation:
Different types of resources are managed by the Os.
When there are multiple users or multiple jobs running at the same time, resources
U
7. Accounting:
ST
We want to keep track of which users use how many and which kinds of
computer resources. This record keeping may be used for accounting or simply for
accumulating usage statistics.
8. Protection:
The owners of information stored in a multiuser computer system may want to
control use of that information. Security of the system is also important.
1.10.6 CP derivatives
1. CP
2. CP-VM
3. CP/M
1. UNIX
P
Unix V5 (SCO Unix)
Modern Unix (Solaris / BSD )
AP
FreeBSD
OpenBSD
2. Xenix
3. Linux
4. Plan 9 jim bading tahaha
Inferno to hell
R
5. QNX
6. VSTa
CO
7. Mac OSX
8. MIPS RISC/os
9. RISC iX
1.10.8 VMS derivatives
1. VMS
U
1. OpenVMS
2. OS/2
ST
1. eComStation
3. Microsoft Windows =rude-magic!
1. ReactOS
1.10.9 MacOS derivatives
1. Mac OS
1. Mac OS 9
1.10.10 Cambridge CAP Computer derivatives
1. KeyKOS
1. EROS
2. Coyotos
3. CapROS
1. OS/360
2. OS/400
1.10.12 AmigaOS Derivatives
1. AmigaOS
2. AROS
1. AmigaOS 4.x
2. MorphOS
1.10.13 Novel Operating Systems
1. Grasshopper
2. ITS
P
3. BeOS
AP
1.11 COMPUTER SYSTEM ORGANIZATION
1.11.1Operating System Structure
1.11.1.1 MS-DOS System Structure
MS-DOS – written to provide the most functionality in the least space.
R
Not divided into modules.
CO
Although MS-DOS has some structure, its interfaces and levels of functionality are not
well separated.
U
ST
P
AP
1.11.1.3 Layered Approach
R
The operating system is divided into a number of layers (levels), each built on top of
lower layers. The bottom layer (layer 0), is the hardware; the highest (layer N) is the user
interface.
CO
each layer uses functions (operations) and services of only lower-level layers.
Each layer is implemented by using only those operations that are provided lower level
layers.
ST
P
one process at a time or all output must be suspect. A properly designed operating system
must ensure that an incorrect (or malicious) program cannot cause other programs to
execute incorrectly.
AP
1.11.2.1 Dual-Mode and Multimode Operation
In order to ensure the proper execution of the operating system, we must be able to
R
distinguish between the execution of operating-system code and user defined code. The
approach taken by most computer systems is to provide hardware support that allows us
to differentiate among various modes of execution.
CO
U
ST
At the very least, we need two separate modes of operation: user mode and kernel mode
(also called supervisor mode, system mode, or privileged mode).
A bit, called the mode bit, is added to the hardware of the computer to indicate the
current mode: kernel (0) or user (1). With the mode bit, we can distinguish between a task
that is executed on behalf of the operating system and one that is executed on behalf of
the user.
1.11.2.2Timer
P
These calls are generally available as assembly-language instructions.
AP
System calls can be grouped roughly into five major categories:
1. Process control
2. file management
3. device management
R
4. information maintenance
CO
5. communications.
1. Process Control
end,abort
load, execute
U
4. Information maintenance
Get time or date, set time or date
Get system data, set system data
Get process, file, or device attributes
P
Set process, file or device attributes
AP
5. Communications
Create, delete communication connection
Send, receive messages
Transfer status information
R
Attach or detach remote devices
Two types of communication models
CO
P
AP
UNIT – II PROCESS MANAGEMENT
Processes-Process Concept, Process Scheduling, Operations on Processes, Interprocess
Communication; Threads- Overview, Multicore Programming, Multithreading Models;
Windows 7 -Thread and SMP Management. Process Synchronization - Critical Section
Problem, Mutex Locks,Semophores, Monitors; CPU Scheduling and Deadlocks.
R
2.1 PROCESSES
CO
processor.
o The other possibility is real parallelism in which two or more processes are
actually running at once because the computer system is a parallel processor, i.e.,
ST
Even though in actuality there are many processes running at once, the OS gives each process the
illusion that it is running alone.
Virtual time: The time used by just these processes. Virtual time progresses at a rate
independent of other processes. Actually, this is false, the virtual time is typically
incremented a little during systems calls used for process switching; so if there are more
other processors more ``overhead'' virtual time occurs.
Virtual memory: The memory as viewed by the process. Each process typically believes
it has a contiguous chunk of memory starting at location zero. Of course this can't be true
Problem of reliability.
Question of security and integrity of user programs and data.
Problem of data communication.
---------------------------------------------------------------------------------------------------------------------------------------------------------
5. COMPUTER-SYSTEM ORGANIZATION
a) Computer-System Operation
Computer system consists of one or more CPUs and a number of device controllers connected through a
common bus that provides access to shared memory. Each device controller is in charge of a specific type of device.
When a computer is powered on or rebooted,
bootstrap program runs. It is stored within the
computer hardware in read-only memory (ROM) or
electrically erasable programmable read-only memory
(EEPROM), known by the general term firmware. It
initializes all aspects of the system, from CPU registers
to device controllers to memory contents. The
bootstrap knows how to load the operating system and how to start executing that system. Once the kernel is loaded
and executing, it waits for an event to occur.
The occurrence of an event is usually signaled by an interrupt from either the hardware or the software.
Hardware may trigger an interrupt at any time by sending a signal to the CPU, usually by way of the system bus.
Software may trigger an interrupt by executing a special operation called a system call. When the CPU is
interrupted, it stops what it is doing and immediately transfers execution to a fixed location. The fixed location usually
contains the starting address where the service routine for the interrupt is located. The interrupt service routine
executes; on completion, the CPU resumes the interrupted computation.
b) Storage Structure
The CPU can load instructions only from memory, so any programs to run must be stored there. General-
purpose computers run most of their programs from rewritable memory, called main memory (also called random-
access memory, or RAM). Main memory commonly is implemented in a semiconductor technology called dynamic
random-access memory (DRAM).
Ideally, we want the programs and data to reside in main memory
permanently. This arrangement usually is not possible for the
following two reasons:
1. Main memory is usually too small to store all needed programs
and data permanently.
2. Main memory is a volatile storage device that loses its contents
when power is turned off or otherwise lost.
Thus, most computer systems provide secondary storage as an
extension of main memory. The main requirement for secondary
storage is that it be able to hold large quantities of data permanently.
The most common secondary-storage device is a magnetic disk,
which provides storage for both programs and data. Most programs
(system and application) are stored on a disk until they are loaded
into memory.
Caching:
Important principle, performed at many levels in a computer (in hardware, operating system, software)
Information in use copied from slower to faster storage temporarily
Faster storage (cache) checked first to determine if information is there
o If it is, information used directly from the cache (fast)
o If not, data copied to cache and used there
Cache smaller than storage being cached
o Cache management important design problem
o Cache size and replacement policy
c) I/O Structure
General-purpose computer system consists of CPUs and multiple device controllers that are connected
through a common bus.
Each device controller is in charge of a specific type of device. Depending on the controller, more
than one device may be attached. For instance, seven or more devices can be attached to the
small Computer-systems interface (SCSI) controller.
A device controller maintains some local buffer storage and a set of special-purpose registers.
The device controller is responsible for moving the data between the peripheral devices that it
controls and its local buffer storage.
Typically, operating systems have a device driver for each device controller. This device driver
understands the device controller and provides the rest of the operating system with a uniform
interface to the device.
To start an I/O operation, the device driver loads the appropriate registers within the device controller. The
device controller, in turn, examines the contents of these registers to determine what action to take (such as “read a
character from the keyboard”). The controller starts the transfer of data from the device to its local buffer. Once the
transfer of data is complete, the device controller informs the device driver via an interrupt that it has finished its
operation. The device driver then returns control to the operating system, possibly returning the data or a pointer to
the data if the operation was a read. For other operations, the device driver returns status information
-------------------------------------------------------------------------------------------------------------------------------------------------------
6. Operating System structure
Multiprogramming (Batch system) needed for efficiency
o Single user cannot keep CPU and I/O devices busy at all times
o Multiprogramming organizes jobs (code and data) so CPU always has one to execute
o A subset of total jobs in system is kept in memory
o One job selected and run via job scheduling
o When it has to wait (for I/O for example), OS switches to another job
Timesharing (multitasking) is logical extension in which CPU switches jobs so frequently that users
can interact with each job while it is running, creating interactive computing
DOWNLOADED FROM STUCOR APP
UNIT – I OPERATING SYSTEMS OVERVIEW
Computer System Overview-Basic Elements, Instruction Execution, Interrupts, Memory
Hierarchy, Cache Memory, Direct Memory Access, Multiprocessor and Multicore
Organization. Operating system overview-objectives and functions, Evolution of Operating
System.- Computer System Organization-Operating System Structure and Operations-
System Calls, System Programs, OS Generation and System Boot.
P
a user of a computer and the computer hardware.
The purpose of an operating system is to provide an environment in which a user can
AP
execute programs.
Operating system
The application programs
Users
ST
The hardware - the central processing unit (CPU), the memory, and the
Input/output (I/O) devices-provides the basic computing resources.
The application programs- such as word processors, spreadsheets, compilers,
and web browsers- define the ways in which these resources are used to
solve the computing problems of the users.
An operating system is similar to a government. The OS simply provides an
environment within which other programs can do useful work.
P
AP
storage space, I/O devices) and allocates them to specific programs and users as
necessary for tasks.
An operating system is a control program. It controls the execution of user programs
to prevent errors and improper use of computer.
control information about the nature of the job (control cards)-and submitted it to the
computer operator.
ST
P
The definitive feature of batch system is the lack of interaction between the user and
the job while the job is executing.
AP
Spooling is also used for processing data at remote sites.
1.1.2 Multiprogrammed Systems
A pool of jobs on disk allows the OS to select which job to run next, to
increase CPU utilization.
R
Multiprogramming increases CPU utilization by organizing jobs such that the CPU
always has one to execute.
CO
The idea is as follows: The operating system keeps several jobs in memory
simultaneously. This set of jobs is a subset of the jobs kept in the job pool. The
operating system picks and begins to execute one of the jobs in the memory.
P
They are microcomputers that are smaller and less expensive than mainframe
computers.
AP
Operating systems for these computers have benefited from the development of
operating systems for mainframes in several ways.
If functions can be distributed properly among several processors, then the failure of
one processor will not halt the system, only slow it down. If we have ten processors
ST
and one fails, then each of the remaining nine processors must pick up a share of the
work of the failed processor.
Thus, the entire system runs only 10 percent slower, rather than failing altogether.
This ability to continue providing service proportional to the level of surviving
hardware is called graceful degradation. Systems designed for graceful degradation
are also called fault tolerant.
Continued operation in the presence of failures requires a mechanism to allow
the failure to be detected, diagnosed, and, if possible, corrected.
The most common multiple-processor systems now use symmetric
multiprocessing (SMP), in whch each processor runs an identical copy of the
operating system, and these copies communicate with one another as needed.
P
Advantages of distributed systems
Resource Sharing
AP
Computation speedup
Reliability
Communication
of stored data to the time that it takes the operating system to finish any request made
of it.
Process management
Main-memory management
File management
P
A program by itself is not a process; a program is a passive entity, such as the
contents of a file stored on disk, whereas a process is an active entity, with a program
AP
counter specifying the next instruction to execute.
A process is the unit of work in a system.
The operating system is responsible for the following activities in connection
with process management:
R
Creating and deleting both user and system processes
Suspending and resuming processes
CO
hundreds of thousands to billions. Each word or byte has its own address.
Main memory is a repository of quickly accessible data shared by the CPU and I/O
devices.
To improve both the utilization of the CPU and the speed of the computer's response
to its users, we must keep several programs in memory.
The operating system is responsible for the following activities in connection
with memory management:
Keeping track of which parts of memory are currently being used and by whom.
P
One of the purposes of an operating system is to hide the peculiarities of
specific hardware devices from the user. This is done using the I/O subsystem.
AP
The I/O subsystem consists of a memory-management component that includes
buffering, caching, and spooling.
A general device-driver interface
Drivers for specific hardware devices
R
(v) Secondary storage management
CO
Because main memory is too small to accommodate all data and programs, and
because the data that it holds are lost when power is lost, the computer system must
provide secondary storage to back up main memory.
The operating system is responsible for the following activities in connection
with disk management:
U
Free-space management
Storage allocation
ST
Disk Scheduling
(vi) Networking
A distributed system is a collection of processors that do not share memory,
peripheral devices, or a clock.
Instead, each processor has its own local memory and clock, and the
processors communicate with one another through various communication lines,
such as high-speed buses or networks.
The processors in the system are connected through a communication network,
which can be configured in a number of different ways.
P
interpreter.
It is the interface between the user and the operating system.
AP
Some operating systems include the command interpreter in the kernel. Other
operating systems, such as MS-DOS and UNIX, treat the command interpreter as a
special program that is running when a job is initiated, or when a user first logs on
(on time-sharing systems).
Many commands are given to the operating system by control statements.
R
When a new job is started in a batch system, or when a user logs on to a time-
shared system, a program that reads and interprets control statements is executed
CO
automatically.
This program is sometimes called the control-card interpreter or the command-
line interpreter, and is often known as the shell.
U
volatile
1.3.2 I/O modules
communications equipment
terminals
1.3.3 System bus