Download as pdf or txt
Download as pdf or txt
You are on page 1of 41

CPE324: Operating System

Lecture

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 1


Learning Objectives
• At the end of this class, the student should be able to:

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 2


Computer System Component
• Computer Systems generally can be roughly divided into four components:
• The hardware
• The operating system
• The application programs
• The users
• The Hardware (the CPU, memory and i/o devices) provides the basic
computing resources for the system
• The Application Programs (word processors, spreadsheets, compilers, and
Web browsers) define the ways in which these resources are used to solve
users' computing problems.
• The operating system controls the hardware and coordinates its use among
the various application programs for the various users.
CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 3
Abstract View of Computing Systems

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 4


Operating System Overview
• An operating system is similar to a government. Like a government, it
performs no useful function by itself. It simply provides an
environment within which other programs can do useful work.
• It is a program that acts as an intermediary between a user of a
computer and the computer hardware
• Operating system goals are:
• Execute user programs and make solving user problems easier.
• Make the computer system convenient to use
• Use the computer hardware in an efficient manner

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 5


Operating Systems Overview
• An amazing aspect of operating systems is how varied they are in
accomplishing these tasks. Mainframe operating systems are
designed primarily to optimize utilization of hardware. Personal
computer (PC) operating systems support complex games, business
applications, and everything in between.
• Operating systems for handheld computers are designed to provide
an environment in which a user can easily interface with the
computer to execute programs.
• Thus, some operating systems are designed to be convenient, others
to be efficient, and others some combination of the two.

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 6


User’s and System’s View of Operating Systems
• The user's view of the computer varies according to the interface being used.
• Single user: The system is designed for one user to monopolize its resources. The goal is to
maximize the work 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
utilisation.

• Multi user: The system is designed for many user at the same time. In this case a user sits at a
terminal connected to a mainframe or a minicomputer, other users are accessing the same
computer through other terminals. These users share resources and may exchange
information. The operating system in such cases is designed to maximize resource utilization
i.e. 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.

• Network users: In network environment, users sit at workstations connected to networks of


other workstations and servers. These users have dedicated resources at their disposal, but
they also share resources such as networking and servers (file, compute, and print servers).
Therefore, their operating system is designed to compromise between individual usability
and resource utilization.

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 7


User and System View of Operating Systems
• Recently, many varieties of handheld computers have come into fashion.
Most of these devices are standalone units for individual users. Some are
connected to networks, either directly by wire or (more often) through
wireless means. Because of power, speed, and interface limitations, they
perform relatively few remote operations. Their operating systems are
designed mostly for individual usability, but performance per unit of battery
life is important as well.

• Some computers have little or no user view. For example, embedded


computers in home devices and automobiles may have numeric keypads and
may turn indicator lights on or off to show status, but they and their operating
systems are designed primarily to run without user intervention.

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 8


User and System View of Operating Systems
• From the system'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:

• Resource allocator: A computer system has many resources that may be


required to solve a problem (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.

• Control program: controls the execution of user programs and operations of


I/O devices in a manner to prevent errors and improper use of the computer
resources.

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 9


Historical Overview of Operating System
• Operating systems and computer architecture have influenced each
other a great deal. To facilitate the use of the hardware, researchers
developed operating systems. Users of the operating systems then
proposed changes in hardware design to simplify them.

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 10


Historical Overview of Operating System
• Mainframe computer systems were the first computers used to tackle
many commercial and scientific applications.
• The mainframe systems grew from simple batch systems, where the
computer runs one-and only one-application, to time-shared systems,
which allow for user interaction with the computer system.
• Batch Systems:
• Early computers were physically enormous machines that were run from a console.
The common input devices were card readers and tape drives. The common output
devices were line printers, tape drives, and card punches. The user did not interact
directly with the computer systems. Rather, the user prepared a job (which consisted
of the program, the data, and some control information about the nature of the job
called control cards) and submitted it to the computer operator. The job was usually
in the form of punch cards. At some later time (after minutes, hours, or days), the
output appeared. The output consisted of the result of the program, as well as a
dump of the final memory and register contents for debugging.

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 11


Historical Overview of Operating System
• The operating system in these early computers was fairly simple. Its major task
was to transfer control automatically from one job to the next. The operating
system was always resident in memory (Figure 2)
• To speed up processing, operators batched together jobs with similar needs and
ran them through the computer as a group. Thus, the programmers would leave
their programs with the operator. The operator would sort programs into batches
with similar requirements and, as the computer became available, would run
each batch. The output from each job would be sent back to the appropriate
programmer.
• In batch execution environment, the CPU is often idle, because the speeds of the
mechanical I/O devices are intrinsically slower than are those of electronic
devices.
• The introduction of disk technology allowed the operating system to keep all jobs
on a disk, rather than in a serial card reader. With direct access to several jobs,
the operating system could perform job scheduling, to use resources and perform
tasks efficiently. This led to Multiprogrammed System

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 12


Batch Systems

Figure 2: Memory layout for a Simple Batch system

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 13


Multiprogrammed Batch System
• The most important aspects of job scheduling is the ability to
multiprogram. A single program cannot, in general keep either the
CPU or the I/O devices busy at all times. Single users frequently have
multiple programs running. Multiprogramming increases CPU
utilization by organizing jobs(code and data) so that the CPU always
has one to execute.

• The OS keeps several jobs in memory simultaneously (figure 3 for


example). Since, in general main memory is too small to
accommodate all jobs, the jobs are kept initially on the disk in the job
pool. This pool consists of all processes residing on disk awaiting
allocation of main memory.

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 14


Multiprogramming feature of OS

Figure 3: Memory layout for a multiprogramming system

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 15


Multiprogramming feature of OS
• The set of jobs in memory can be a subset of the jobs kept in the job
pool. The operating system picks and begins to execute one of the
jobs in memory. Eventually, the job may have to wait for some task,
such as an I/O operation to complete.
• In a non-multiprogrammed system, the CPU would sit idle. However
in a multiprogrammed system, the operating system simply switches
to, and executes, another job. When that job needs to wait, the CPU
is switched to another job, and so on. Eventually the first job finishes
waiting and gets the CPU back. As long as at least one job needs to
execute, the CPU is never idle.

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 16


Time Sharing/Multi-tasking feature of OS
• Multiprogrammed batched systems provide an environment in which
the various system resources (CPU, memory, and peripheral devices)
are utilized effectively, but they do not provide for user interaction
with the computer system.
• Time Sharing (or Multitasking) is a logical extension of
multiprogramming. In time-sharing systems, the CPU executes
multiple jobs by switching among them, but the switches occur so
frequently that the users can interact with each program while it is
running.

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 17


Desktop Systems
• This are computer system dedicated to a single user I/O devices –
keyboards, mice, display screens, small printers
• It is concerned with user’s convenience and responsiveness
• Operating systems for these computers have benefited in several
ways from the development of operating systems for mainframes
• Often individuals have sole use of computer and do not need
advanced CPU utilization of protection features
• These systems include PCs running Microsoft Windows and the Apple
Macintosh. The MS-DOS operating system from Microsoft has been
superseded by multiple flavours of Microsoft Windows, and IBM has
upgraded MS-DOS to the OS/2 multitasking system.
CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 18
Multiprocessor Systems
• Systems with more than one CPU in close communication, sharing
system bus, clock, and sometimes memory and peripheral devices
• Also known as parallel systems or tightly coupled systems. The have
three advantages:
• Increased throughput
• Economy of scale: Multiprocessor systems can save more money than
multiple single-processor systems, because they can share peripherals, mass
storage, and power supplies. If several programs operate on the same set of
data, it is cheaper to store those data on one disk and to have all the
processors share them, than to have many computers with local disks and
many copies of the data.
• Increased reliability

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 19


Multiprocessor Systems
Two implementation of multiprocessor system are:
• Asymmetric multiprocessing
• Each processor is assigned a specific task; master processor schedules and
allocated work to slave processors
• More common in extremely large systems
• Symmetric multiprocessing (SMP)
• Each processor runs and identical copy of the operating system
• Many processes can run at once without performance deterioration
• Most modern operating systems support SMP

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 20


Distributed Systems
Distributed systems depend on networking for their functionality. By being able to
communicate, distributed systems are able to share computational tasks, and
provide a rich set of features to users.
• 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
• Requirements
• Requires networking infrastructure
• Local area networks (LAN) or Wide area networks (WAN)
• May be either client-server or peer-to-peer systems

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 21


Clustered Systems
• Clustering allows two or more systems to share storage
• Provides high reliability
• Asymmetric clustering: one server runs the application or applications
while other servers is in hot standby. The hot standby host (machine)
does nothing but monitor the active server. If that server fails, the hot
standby host becomes the active server.
• Symmetric clustering: In symmetric mode, two or more hosts are
running applications, and they are monitoring each other. This mode
is obviously more efficient, as it uses all of the available hardware. It
does require that more than one application be available to run.

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 22


Real Time Systems
• Another form of a special-purpose operating system is the real-time
system. A real-time system is used when rigid time requirements have
been placed on the operation of a processor or the flow of data
• Often used as a control device in a dedicated application such as
controlling scientific experiments, medical imaging systems, industrial
control systems, and some display systems
• A real-time system has well-defined, fixed time constraints.
Processing must be done within the defined constraints, or the
system will fail.
• Real-Time systems may be either hard or soft real-time

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 23


Real Time Systems
• Hard real-time:
• Secondary storage limited or absent, data stored in short term memory, or
read-only memory (ROM)
• Conflicts with time-sharing systems, not supported by general-purpose
operating systems
• Soft real-time
• Limited utility in industrial control of robotics
• Integrate-able with time-share systems
• Useful in applications (multimedia, virtual reality) requiring tight response
times

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 24


Handheld Systems
• Personal Digital Assistants (PDAs)
• Mobile phones
• Issues:
• Limited memory
• low processors
• Small display screens

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 25


Functions of Operating Systems
• Process Management
• Main Memory Management
• I/O System Management
• Secondary Storage Management
• Protection and Security

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 26


Process Management
• A process is a program in execution
• A process needs certain resources, including CPU time, memory, files, and I/O
devices, to accomplish its task
• It is the unit of work in a system. Such a system consists of a collection of
processes, some of which are operating-system processes (those that
execute system code) and the rest of which are user processes (those that
execute user code). All these processes can potentially execute
concurrently, by multiplexing the CPU among them.
• The operating system is responsible for the following activities in
connection with process management
• Process creation and deletion
• Process suspension and resumption
• Provision of mechanisms for process synchronization
• Provision of mechanisms for process communication
• Providing mechanisms for deadlock handling

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 27


Main Memory Management
• Main Memory is a large array of words or bytes, each with its own
address
• It is a repository of quickly accessible data shared by the CPU and I/O devices
• Main memory is a volatile storage device. It loses its contents in the
case of system failure
• The operating system is responsible for the following activities in
connections with memory management:
• Keep track of which parts of memory are currently being used and by who
• Decide which processes to load when memory space becomes available
• Allocate and deallocate memory space as needed

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 28


File Management
• File management is one of the most visible function of an operating
system. Computers can store information on several different types of
physical media. Magnetic tape, magnetic disk, and optical disk are the most
common media. Each of these media has its own characteristics and
physical organization.
• A file is a collection of related information defined by its creator. It
commonly represents programs (both source and object forms) and data
• The operating system is responsible for the following activities in
connections with file management:
• File creation and deletion
• Directory creation and deletion
• Support of primitives for manipulating files and directories
• Mapping files onto secondary storage
• File backup on stable (nonvolatile) storage media

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 29


I/O System Management
• One of the purposes of an operating system is to hide the
peculiarities of specific hardware devices from the user.
• The I/O subsystem of OS consists of:
• A memory-management component that includes buffering, caching, and
spooling
• A general device-driver interface
• Drivers for specific hardware devices

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 30


Secondary Storage Management
• 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
• Most modern computer systems use disks as the
• principal on-line storage medium, for both programs and data
• The operating system is responsible for the following activities in
connection with disk management:
• Free space management
• Storage allocation
• Disk scheduling

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 31


Protection and Security
• Protection refers to a mechanism for controlling access by programs,
processes, or users to both system and user resources
• The protection mechanism must:
• distinguish between authorized and unauthorized usage
• specify the controls to be imposed
• provide a means of enforcement

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 32


Operating Systems Services
The following are the services provided by the OS:
• Program execution – system capability to load a program into memory and to run it
• I/O operations – since user programs cannot execute I/O operations directly, the
operating system must provide some means to perform I/O
• File-system manipulation – program capability to read, write, create, and delete files
• Communications – exchange of information between processes executing either on the
same computer or on different systems tied together by a network. Implemented via
shared memory or message passing
• Error detection – ensure correct computing by detecting errors in the CPU and memory
hardware, in I/O devices, or in user programs
• Resource allocation – allocating resources to multiple users or multiple jobs running at
the same time
• Accounting – keep track of and record which users use how much and what kinds of
computer resources for account billing or for accumulating usage statistics
• Protection – ensuring that all access to system resources is controlled

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 33


Command-Interpreter System
• One of the most important systems programs for an operating system
is the command interpreter, which is the interface between the user
and the operating system. It is variously called:
• command-line interpreter
• shell (in UNIX)
• Command prompt
• Its function is to get and execute the next command statement

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 34


System Call
• System calls provide the interface between a process and the operating
system. These calls are generally available as assembly-language
instructions, and they are usually listed in the various manuals used by the
assembly-language programmers.
• Several languages, such as C, C++, and Perl have been defined to replace
assembly language for systems programming. These languages allow
system calls to be made directly. For example, UNIX system calls may be
invoked directly from a C or C++ program.
• Three general methods are used to pass parameters between a running
program and the operating system
• Pass parameters in registers
• Store the parameters in a table in memory, and the table address is passed as a
parameter in a register
• Push (store) the parameters onto the stack by the program, and pop off the stack by
operating system

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 35


MS-DOS System Structure
• MS-DOS – Microsoft Disk Operating System written to provide the
most functionality in the least space (because of the limited hardware
on which it ran)
• Not divided into modules
• Although MS-DOS has some structure, its interfaces and levels of
functionality are not well separated

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 36


Structure of MS-DOS

Figure 4: MS-DOS Layer Structure

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 37


UNIX System Structure
• UNIX is another system that was initially limited by hardware
functionality.
• It consists of two separable parts: the kernel and the system
programs
• The kernel is further separated into a series of interfaces and device
drivers, which were added and expanded over the years as UNIX
evolved.
• Figure 5 shows UNIX OS as being layered. Everything below the
system-call interface and above the physical hardware is the kernel.
• The kernel provides the file system, CPU scheduling, memory
management, and other operating system functions through system
calls.

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 38


Structure of UNIX OS

Figure 5: UNIX System Structure

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 39


Virtual Machines
• Describe the structure of Windows OS.

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 40


Assignment
• Describe the structure of Windows OS and IBM OS/2 OS.

CPE324: Operating Systems -Ekiti State University, Ado-Ekiti 41

You might also like