0% found this document useful (0 votes)
7 views

ch1 os last

Uploaded by

maxmach27
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)
7 views

ch1 os last

Uploaded by

maxmach27
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/ 43

Operating Systems

✓ What is an Operating System

✓ Computer System Structure

✓ What Operating Systems Do


✓ Operating-System Types

✓ Operating system design and Implementation


Chapter 1: Introduction
What is an Operating System?
• An OS is a program that controls the execution of application
programs and acts as an interface between applications and the
computer hardware.
• It can be thought of as having three objectives:
• Convenience: An OS makes a computer more convenient to use.
• Efficiency: An OS allows the computer system resources to be used in
an efficient manner.
• Ability to evolve: An OS should be constructed in such a way as to
permit the effective development, testing, and introduction of new
system functions without interfering with
Computer System Structure
➢ Computer system can be divided into four components
• Hardware –
▪ provides basic computing resources
CPU, memory, I/O devices
• Operating 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 games
• Users
▪ People, machines, other computers
1. User view of OS
User's view of a computer varies according to the interface being used.
• PC
• One user monopolizes resources.
• The goal is to maximize the work (or play) that the user is performing. In this
case/ the operating system is designed mostly for ease of use with some
attention paid to performance and none paid to resource utilization various
hardware and software resources are shared.
• Optimized for the single‐user experience rather than the requirements of
multiple users.
User view of OS Cont’d
Minicomputer or Mainframe
• More than one user Access the system though their terminals.
• Users share resources and may exchange information.
• OS in such cases is designed to maximize resource utilization to
assure that all available CPU time, memory, and I/0 are used
efficiently and that no individual user takes more than her fair
share.
Wokrstations
• Users have dedicated resources at their disposal, but they also
share resources such as networking and servers‐file, compute,
and print servers.
• OS is designed to compromise between individual usability and
resource utilization.
User view of OS Cont’d
• handheld computers
• Most of these devices are standalone units for individual users.
• Have power, speed, and interface limitations.
• OS designed mostly for individual usability, but performance
per unit of battery life is important as well.
• Embedded computers
• In home devices and automobiles may have numeric keypads
and may turn indicator lights on or off to show status.
• OS designed primarily to run without user intervention.
2.System View of OS
• From the computer's point of view, the operating system is the program
most intimately involved with the hardware.
• In this context, we can view an operating system as a resource allocator .
A computer system has many resources such as CPU time, memory space,
file‐storage space, I/0 devices, and so on.
▪ The operating system acts as the manager of these resources. Facing
numerous and possibly conflicting requests for resources.
▪ The operating system must decide how to allocate them to specific
programs and users so that it can operate the computer system efficiently and
fairly.
Operating System Types
✓ Internally, operating systems vary greatly in their makeup, since they are organized
along many different lines. There are, however, many commonalities, which we
consider in this section

Multiprogramming (Batch system) needed for efficiency


Single user cannot keep CPU and I/O devices busy at all times
Multiprogramming organizes jobs (code and data) so CPU always has one to
execute
A subset of total jobs in system is kept in memory
One job selected and run via job scheduling
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
Response time should be < 1 second
Each user has at least one program executing in memory process
If several jobs ready to run at the same time CPU scheduling
If processes don’t fit in memory, swapping moves them in and out to run
DESKTOP SYSTEMS
Personal computers – computer system
dedicated to a single user.
I/O devices – keyboards, mice, display screens,
small printers.
User convenience and responsiveness
May run several different types of operating
systems (Windows, MacOS, UNIX, Linux)
PARALLEL SYSTEMS
Multiprocessor systems with more than one CPU
in close communication.
Tightly coupled system – processors share
memory and a clock; communication usually
takes place through the shared memory.
Advantages of parallel system:
・ Increased throughput
・Economical
・Increased reliability
PARALLEL SYSTEMS (CONT.)
Symmetric multiprocessing (SMP)
・Each processor runs an identical copy of the
operating system.
・Many processes can run at once without
performance deterioration.
・Most modern operating systems support SMP
Asymmetric multiprocessing
・Each processor is assigned a specific task; master
processor schedules and allocated work to slave
processors.
・More common in extremely large systems
DISTRIBUTED SYSTEMS
Distribute the computation among several
physical processors.
Loosely coupled system – each processor has its
own local memory; processors communicate with
one another through various communications
lines, such as high-speed buses or telephone lines.
Advantages of distributed systems.
・ Resources Sharing
・Computation speed up – load sharing
・Reliability
・Communications
DISTRIBUTED SYSTEMS (CONT)
Requires networking infrastructure.
Local area networks (LAN) or Wide area
networks (WAN)
May be either client-server or peer-to-peer systems.
Real Time Systems
Definition: A real‐time system is a computer system where a timely
response by the computer to external stimuli is vital!
‐>Eg: Air traffic control, Industrial control systems, Nuclear power plant
• Hard real‐time system: The system has failed if a timing constraint, e.g.
deadline, is not met.
• All delays in the system must be bounded.
• Many advanced features are absent.
• Soft real‐time system: Missing a timing constraint is serious, but does not
necessarily result in a failure unless it is excessive
• A critical task has a higher priority.
• Supported in most commercial OS.
• Real‐time means on‐time instead of fast
Operating System Concepts
Bootstrap program is loaded at power‐up or reboot
• Typically stored in ROM or EPROM, generally known as firmware
• Initializes all aspects of system (CPU registers, device controllers, memory contents,
etc.)
• Loads operating system kernel and starts execution
• The operating system then starts executing the first process (init) and
waits for some event to occur.
• The occurrence of an event is signaled by an interrupt from either the
hardware and the software:
• hardware may trigger an interrupt by sending a signal to the CPU
• software may trigger an interrupt by executing a special operation called system call
(or monitor call).
Process
✓ A process is a program in execution. It is a unit of work within the
system. Program is a passive entity, process is an active entity.
✓ Process needs resources to accomplish its task
▪ CPU, memory, I/O, files
▪ Initialization data
✓ Process termination requires reclaim of any reusable resources
✓ Processes can create sub‐processes to execute concurrently.
✓ The execution of a process must progress in a sequential fashion.
The CPU executes one instruction of the process after another
until the process completes.
✓ Processes may be:
• Operating System processes: Those execute system code.
• User processes: Those that execute user code.
Cont’d
The operating system is responsible for the following activities in
connection with process management:
• Process creation and deletion
• Suspending and resuming processes
• Providing mechanisms for:
process synchronization
process communication
• Providing mechanisms for deadlock handling
Memory

✓ To execute a program all (or part) of the instructions must be in memory


✓ All (or part) of the data that is needed by the program must be in
memory.
✓ Memory management determines what is in memory and when
Optimizing CPU utilization and computer response to users

✓ Memory management activities
▪ Keeping track of which parts of memory are currently
being used and by whom
▪ Deciding which processes (or parts thereof) and data to
move into and out of memory
▪ Allocating and deallocating memory space as needed
Secondary Storage
• Since main memory (primary storage) is volatile and too small
to accommodate all data and programs permanently, 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:
▪ Free space management
▪ Storage allocation
▪ Disk scheduling
File
✓ A file represents a collection of related information. Computer can
store files on disk (secondary storage), for long term storage purpose.
✓ A file system is normally organized into directories for easy
navigation and usage. These directories may contain files and other
directions.
✓ Following are the major activities of an operating system with
respect to file management.
▪ File creation and deletion.
▪ Directory creation and deletion.
▪ Mapping files onto secondary storage.
• File backup on stable (nonvolatile) storage media.

System Calls
• System calls: The mechanism used by an application program to
request service from the operating system.
• System call is how a program requests a service from an operating
system. 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 an essential interface between a process and
the operating system.
The Shell
• The shell manages the interaction between user and the operating
system by prompting the user for input, interpreting that input for the
operating system, and then handling any resulting output from the
operating system.
• Shell is an interface to kernel, hiding complexity of kernel's functions
from users. Takes commands from user and executes kernel's
functions.
Kernel ‐ Core component of Operating System, interacts directly with
hardware, provides low level services to upper layer components.
Typical services provided by OS
• Program development: OS provides a variety of facilities and services, such as
editors and debuggers, to assist the programmer in creating programs. These are
supplied with the OS and are referred to as application program development
tools.
• Program execution: Instructions and data must be loaded into main memory,
I/O devices and files must be initialized, and other resources must be prepared.
The OS handles these scheduling duties for the user.

• Access to I/O devices: Each I/O device requires its own peculiar set of
instructions The OS provides a uniform interface that hides these details so that
programmers can access such devices using simple reads and writes.
• Controlled access to files: For file access, the OS must reflect a detailed
understanding of not only the nature of the I/O device (disk drive, tape drive) but
also the structure of the data contained in the files on the storage medium. In the
case of a system with multiple users, the OS may provide protection mechanisms
to control access to the files.
• System access: For shared or public systems, the OS controls access to the system as a
whole and to specific system resources.The access function must provide protection of
resources and data from unauthorized users and must resolve conflicts for resource
contention.
• Error detection and response: Internal and external hardware errors, such as a
memory error, or a device failure or malfunction; and various software errors, such
as division by zero, attempt to access forbidden memory location, and inability of
the OS to grant the request of an application can occur. In each case, the OS must
provide a response that clears the error condition with the least impact on running
applications. The response may range from ending the program that caused the
error, to retrying the operation, to simply reporting the error to the application.
Accounting: A good OS will collect usage statistics for various resources and monitor
performance parameters such as response time. On any system, this information is
useful in anticipating the need for future enhancements and in tuning the system to
improve performance. On a multiuser system, the information can be used for billing
purposes.

Operating system Structure


Operating system design and Implementation
➢ Design Goals
User goals and System goals
• User goals
– operating system should be convenient to use, easy to learn, reliable,
safe, and fast
• System goals
– operating system should be easy to design, implement, and maintain,
as well as flexible, reliable, error‐free, and efficient
Mechanisms and Policies

Important principle to separate


Policy: What will be done?
Mechanism: How to do it?
• Mechanisms determine how to do something, policies decide what will
be done
• The separation of policy from mechanism is a very important principle, it allows
maximum flexibility if policy decisions are to be changed later
Operting System Implemnttion

• Traditionally written in assembly language, operating systems can


now be written in higher‐level languages.
• Code written in a high‐level language:
▪ can be written faster.
▪ is more compact.
▪ is easier to understand and debug.
• An operating system is far easier to port (move to some other
hardware) if it is written in a high‐level language.
Monolithic Systems
✓ An enormous amount of functionality is combined into one level.
✓ Exmple:
- MS-DOS
- UNIX
MS-DOS, the interfaces and levels of functionality are not wellseparated.
- For instance, application programs are able to access the basic I/O
routines to write directly to the display and disk drives. Such freedom
leaves MS-DOS vulnerable to errant (or malicious) programs, causing
entire system crashes when user programs fail.

✓ This monolithic structure was difficult to implement and


maintain.
Layered Systems
• 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.
• With modularity, layers are selected such that each uses
functions (operations) and services of only lower‐level layers
Virtual Machines
• A virtual machine takes the layered approach to its logical conclusion. It treats
hardware and the operating system kernel as though they were all hardware.
• A virtual machine provides an interface identical to the underlying bare
hardware.
• The operating system host creates the illusion that a process has its own
processor and (virtual memory).
• Each guest provided with a (virtual) copy of underlying computer.
• Difficult to implement – must provide an exact duplicate of underlying machine
• Typically runs in user mode, creates virtual user mode and virtual kernel mode
• Timing can be an issue – slower than real machine
• Hardware support needed
• More support‐> better virtualization,
• i.e. AMD provides “host” and “guest” modes
(a) Non virtual machine (b) virtual machine

The End

You might also like