0% found this document useful (0 votes)
19 views37 pages

Os Chapter One

Uploaded by

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

Os Chapter One

Uploaded by

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

Chapter one

History and overview of operating system


History of operating system
 First generation: 1945 – 1955
• Vacuum tubes
• Plug boards
Second generation: 1955 – 1965
• Transistors
• Batch systems
Third generation: 1965 – 1980
• Integrated circuits
• Multiprogramming
Fourth generation: 1980 – present
• Large scale integration
• Personal computers -DOS
1.2 Definition and Objectives of an Operating System(OS)
• Operating system(OS) is system program that controls execution of application
programs.
• System program that acts as an interface between the hardware and its users
• Hardware: consists of CPU, memory, chips, boards, disks, a keyboard,
monitor, printers, and similar physical objects.
• Computers have two modes of operation:
kernel mode ( also called supervisor mode)
• Input/output runs in Kernel mode
User mode.
• User interface program, shell (text based), Graphical User Interface (GUI) and
gooey (GUI that uses icons) runs in User mode.
• User interface program allows the user to start other programs, such as a Web
browser, email reader, or music player,
• although it uses the operating system to get its work done
Basic functions of an operating system include:
• Booting: An operating system manages the startup of a device.
• Memory management: An operating system coordinates computer
applications and allocates space to different programs installed in the
computer.
• Data security: An operating system protects your data from cyber attacks.
• Loading and execution: An operating system starts and executes a program.
• Drive/disk management: An operating system manages computer drives
and divides disks.
• Device control: An operating system enables you to allow or block access to
devices.
• User interface: This part of an operating system, also known as UI, allows
users to enter and receive information.
• Process management: The operating system allocates space to enable
computer processes, such as storing and sharing information.
OS used to allocate resources:
• Allocation of the Processors (CPU), memories, printers and I/O devices
among the various programs wanting them.
OS used to manage resources:
• Manage resources such as processors, main memory, disks, printers, a
keyboard, a mouse, a display, network interfaces, input/output devices, files,
security etc.
• Includes multiplexing (sharing) resources in two different ways: in time and
in space.
• Time multiplexing: programs or users take turns using it. Examples:
• Running multiple programs on a single CPU
• sharing a single printer for multiple printing jobs
• Space multiplexing: each process gets part of the resource. Examples:
• dividing main memory among several running programs
• Allocating disk space and keeping track of who is using which disk blocks.
1.3 Objectives of OS
Convenience(Primary goal)– Top Down View – Virtual Machine
• Extending the real hardware and acting as a Virtual Machine
• Hiding the truth about the hardware from the user
• Providing the user a convenient interface which is easier to program
Efficiency (Secondary goal) – Bottom Up View – Resource Manager
• Providing an orderly and controlled allocation of resources
• Improving resource utilization
Ability to Evolve
• Adaptability to new changes
• Hardware upgrades/New types of hardware
• Need of new services
• Easy to fix latent errors
1.4 Types of Operating system

• Simple batch processing


• Spooling batch processing
• Multi-programmed batch processing
• Timesharing
• Multiprocessing
• Real time processing
• Networked processing
• Distributed processing
 Simple batch processing
• To run jobs
• Users submit jobs on cards
• Operator batches jobs together into a tape inside the input room
• Operator rewinds the input tape and brings it to machine room
• Monitor, a special system program in the system tape, runs each job sequentially
• Output is written onto output tape and is brought to output room
• Output is printed offline in the output room
• Each job is structured using JCL (Job Control Language)
• To switch control back and forth between job and monitor
• To automate job set-up (loading source code, compilers, object code etc)
• Monitor or controls sequence of events
• Relies on some hardware features
• Memory protection
• Timer
• Processor modes
• Interrupts
• Improve machine utilization
• Handle scheduling problem
• Reduce set-up time
Drawbacks
• Large turn-around time
• Large CPU idle time on heavily I/O bound jobs
• Large CPU idle time due to slower speed of I/O devices compared to CPU speed
• CPU idle time between batches of jobs: the computer still needs to read the deck
of cards before it begins to execute the batch of jobs.
• efficiency is less
• throughput is less
• it is not interactive
Spooling Batch Processing
• Adds up Spooling technique to simple batch processing
• Spooling - Simultaneous Peripheral Operation Online
• It is the ability to read jobs/print job outputs while the processor executes jobs
• Read jobs – from cards to disk
• Print job outputs – from disk to printer
• Used in input and output operations
• With spooling, whenever a running job finished, the OS could load a new job from disk into
the now-empty partition and run it
• Spooling is the first attempt of multiprogramming
• Avoids CPU idle time between batches of jobs
• Improve turn-around time: Output of a job was available as soon as the job completed,
rather than only after all jobs in the current cycle were finished.
Drawbacks
• Large turn-around time
• Large CPU idle time on heavily I/O bound jobs
Multi-programmed (Extension of Batch Processing)
• Sharing the processor, when two or more programs reside in memory at the same
time, is referred as multiprogramming.
• Multiprogramming
• Whenever jobs go to I/O device CPU can take other jobs and process
it ,this is called multiprogramming
• Multiple jobs are loaded in a partitioned memory
• Processor runs the jobs by cycling through them in some order
• Processor works on each job for a specified period of time
• The system is responsible for
• Starting user jobs
• Spooling operations
• I/O for user jobs
• Switching between user jobs
• Ensuring proper protection
• Relies on some hardware features
• Memory protection
• Timer
• Processor modes
• Interrupts
• DMA (Direct Memory Access)
• OS/360 – the first multi-programmed batch system designed for IBM System/360
• Improve machine utilization
• Resemble a modern operating system
• CPU use efficiently( we cannot keep the CPU idle)
Drawbacks
• Long response time: the time between submitting a job and getting back the
output was often took several hours.
• Poor interactivity between programmer and the program
Multitasking (Timesharing/Time-slicing)

• Variant of multiprogramming in which each user has an online terminal

• Processor time is shared among multiple users

• Its main objective is getting quick response time

• The computer provides fast, interactive service to a number of users

• CTSS – the first timesharing system developed for IBM 709 and later to IBM
7094

• CTSS supported 32 users at a time

• Minimizes response time

• Support many users simultaneously


Difference between multiprogramming and timesharing
• Multiprogramming
• Its objective is to maximize processor use
• JCL commands are source of directives to the OS
• Designed to keep the processor & I/O devices simultaneously busy
• Timesharing
• Its objective is to minimize response time
• Terminal commands are sources of directives to the OS
• Designed to be responsive to the needs of individual user
Drawbacks of multiprogramming and timesharing
• Problems related with multiple programs in memory interfering with each other
• Problems related with multiple interactive users accessing the same file system
• Problems related with multiple programs competing for the same resource.
Multiprocessing
• A multiprocessor system consists of several processors that share a common
physical memory.
• Multiprocessor system provides higher computing power and speed.
• In multiprocessor system all processors operate under single operating system.
• Multiplicity of the processors and how they do act together are transparent to the
others.
• Enhanced performance
• If possible, system divides task into many subtasks and then these subtasks can be
executed in parallel in different processors.
• Instead of having one CPU we will have more CPU in the single computer.
• Used as batch processing, multitasking and multiprocessing
• less cost and more efficiency
• throughput (the number of jobs which are going to be finished per unit time) can
be improved
• Reliability increase
Real-time processing
• Real-time systems are usually dedicated, embedded systems.
• In such systems, Operating Systems typically read from and react to sensor data.
• The Operating system must guarantee response to events within fixed periods of
time to ensure correct performance.
• You have given some jobs and jobs have some deadlines, you are supposed to
finish the jobs in these deadlines is called real time.
• Programs are guaranteed to have an upper bound on tasks that they carry out
Usually it is desired that the upper bound be very small
• Severely constrained by the timing requirements
• Usually used in dedicated/special purpose computers
Networked Processing
• Consist of multiple computers that are networked together
• Each machine runs its own local OS and has its own local users
• Not fundamentally different from single computer OSs
• Users are aware of existence of multiple computers
• Additional features needed by network operating systems
• Network interface controller
• Some low level software to drive it
• Programs for remote login & remote file access
Distributed Processing
• Runs on a multi-computer system: collection of computers, each with its own memory,
storage device and other I/O modules
• Useful for sharing of the workload among the different computers
• Existence of multiple computers is transparent to the user: It appears as a uniprocessor
system
• It differs in critical ways from uniprocessor OSs
1.5 Computer Hardware's Review
Processors (CPU)
• The CPU cycle or Clock Cycle
• Fetches instructions from memory
• Decodes the instruction
• Executes them.
• E.g. when we say that a computer runs at 2 GHz we mean that to execute one
instruction it takes the computer 1/2 Nano-seconds.
• CPU design: pipeline and superscalar CPU
A. Pipeline CPU:A CPU might have separate fetch, decode, and execute units,
so that while it is executing instruction n, it could also be decoding instruction
n+1 and fetching instruction n+2.
B. Superscalar CPU: advanced than a pipeline design.
• Multiple execution units are present, for example, one for integer
arithmetic, one for floating-point arithmetic, and one for Boolean
operations.
• several instructions can be initiated simultaneously and executed
independently.
• Two or more instructions are fetched at once, decoded, and dumped
into a holding buffer until they can be executed.
Memory
• The memory system is constructed as a hierarchy of layers. The top
layers have higher speed.
A device driver
• Every device connected in the computer has to be recognized by the operating
system.
• Device driver is a software program written by device windows to let the device
communicate with the operating system.
Booting Computer
• Modern operating systems are designed to run on machines with a wide range of
different hardware.
• Booting - starting a computer by loading the kernel.
• Bootstrap program - code stored in ROM that is able to locate the kernel, load it into
memory, and start its execution.
• Once the kernel is loaded it must identify all the hardware present in the machine and
load relevant device drivers.
• Firmware used to hold initial boot code
1.6 Operating System Services and System Calls
• The operating system provides services in the following areas:
Program Execution
• Handles all the setup operations needed by programs before they start to run.
• Loading the program, Initializing I/O devices and files and preparing other resources
needed by the program.
• Operating system loads a program into memory and executes the program.
• The program must be able to end its execution, either normally or abnormally.
I/O Operation
• Each I/O device requires its own peculiar set of instructions and control signals for
operation.
• The operating system provides a uniform interface that hides these details so that the
programmer can access the devices using simple reads and writes.
• I/O means any file or any specific I/O device.
• Program may require any I/O device while running.
• So operating system must provide the required I/O.
File-system manipulation
• Program capability to read, write, create, and delete files.
• Program needs to read a file or write a file.
• The operating system gives the permission to the program for operation on file.
Communication:
• Data transfer between two processes is required for some time.
• Processes are on the one computer or on different computer but connected through
computer network.
Error detection
• Potential system errors
• Hardware related
• Memory error
• Device failure or malfunction
• Software related
• Arithmetic overflow
• Attempt to access forbidden memory location
• Inability of the operating system to grant request of an app.
• The operating system provides response that clears the error condition with the
least impact on running application:
• Ending the program that caused the error

• Retrying the operation

• Reporting the error to the application

• Ensure correct computing by detecting errors in the CPU and memory hardware,
in I/O devices, or in user programs.

• Error may occur in CPU, in I/O devices or in the memory hardware.

• The operating system constantly needs to be aware of possible errors.

• It should take the appropriate action to ensure correct and consistent computing.
Resource Allocation:
• If there are more than one user or jobs running at the same time, then resources
must be allocated to each of them.
• Operating system manages different types of resources require special allocation
code, i.e. main memory, CPU cycles and file storage.
• There are some resources which require only general request and release code
• For allocating CPU, CPU scheduling algorithms are used for better utilization of
CPU.
• CPU scheduling algorithms are used for better utilization of CPU.
• CPU scheduling routines consider the speed of the CPU, number of available
registers and other required factors.
Accounting
• Collects usage statistics for various resources
• Monitor performance parameters such as response time
• Accounting information is useful For future enhancement
• In tuning the system to improve performance
• For billing purposes (in multi-user environment)
• Logs of each user must be kept.
• It is also necessary to keep record of which user how much and what kinds
of computer resources.
• This log is used for accounting purposes.
• The accounting data may be used for statistics or for the billing.
• It also used to improve system efficiency.
Shell( program execution )
• Command interpreter that acts as a primary interface between a user sitting at its
terminal and the operating system
• It is a process (running program) that reads commands
• It is not part of the operating system but it makes heavy use of many operating
system features
• How the shell works?
• When any user logs in, a shell is started up
• The shell displays a prompt which tells the user that it is ready to accept a
command
• When the user enters a command, the shell creates a child process that runs the
program for the corresponding command
• When the child process is running, the shell waits for it to terminate
• When the child process finishes, the shell displays the prompt and tries to read
the next command
1.7 operating system structure
• Size and complexity of operating systems has been growing over the years
• More and more features have been added
• Hardware has become more capable and versatile
• The size and complexity has created some major problems
• Late delivery
• Latent bugs
• Performance
• The essence of operating system structure is to manage the complexity of the
software
• Operating system structure refers to the internal organization of the software
• Four types of OS structures:
• Monolithic system
• Layered system
• Virtual machines
• Client server system
Monolithic Systems
• Has no structure
• Collection of procedures
• Each procedure has a well-defined interface (in terms of parameters & results)
• Each procedure can call any other one: No information hiding
• Composed of main program, service procedures and utility procedures
• Has one big monolithic kernel
• Implemented as a single process
• To get service:
• User program puts the parameters in well-defined places (registers/stack)
• A special trap instruction known as kernel/supervisor call is invoked
• Switches the machine from user mode to kernel mode
• Transfers control to the OS
• OS determines the required service
• OS calls the required service procedure
• Control is returned to user program
Layered/Hierarchical Systems
• Organizes the system as a series of levels (layers).
• Each level performs a related subset of functions
• Each level relies on the next lower level
• To perform more primitive functions
• To conceal the details of those functions
• Each level provides service to the next higher level
• Levels are defined in a way that changes in one level does not require changes
in other levels
• The first layered system was called THE and has 6 layers
• Layer 0: Process allocation and multiprogramming
• Processor allocation
• Process switching
• Layer 1: Memory and drum management
• Allocate space for processes
• Layer 2: Operator process communication
• Handle communication between process and operator console
• Layer 3: I/O management
• Manages I/O devices and buffering information streams to and from them
• Layer 4: User programs
• Layer 5: Operator
Virtual Machines
• The essence of virtual machine systems is to separate the two functions of
timesharing systems
• Multiprogramming
• Extending the machine with a more convenient interface
• VM/370
• Virtual machine system developed for IBM/360s
• Originally called CP/CMS (conversional monitor system)
• Radically different from TSS/360, official timesharing system for IBM/360s,
which was delivered late
• Virtual Machine Monitor
• The heart of VM/370
• Runs on the bare hardware
• Provides multiprogramming & several virtual machines (CPMs) to the next
layer up
• The virtual machines are not extended machines but they are exact
copies of the bare hardware
• Each virtual machine can run any operating systems
Client-Server Model
• Most OS functions are implemented in user processes
• Moves the code up into higher layers and leaves a minimal kernel
(microkernel)
• User process (called client process) sends a request to a server process,
which does the work and sends back the answer
• All the kernel does is handling the communication between clients and
servers
Advantages
• Manageability (flexibility and easy implementation)
• The OS is broken down into parts
• Each part handles only one function of the system
• Each part becomes small and manageable
• Better system protection
• The whole machine will not be down easily since all servers run in user mode,
i.e. servers do not have direct access to the hardware
• Adaptability to distributed systems
• Client need not know where its request is handled: locally or on remote
machine

You might also like