0% found this document useful (0 votes)
6 views20 pages

Os Notes New New

The document provides an introduction to operating systems, detailing their functions, structures, and operations. It explains the roles of hardware, application programs, and users, and discusses various system architectures, including single-processor, multiprocessor, and clustered systems. Additionally, it covers process management, operating system services, and user interfaces, emphasizing the importance of resource allocation and system security.

Uploaded by

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

Os Notes New New

The document provides an introduction to operating systems, detailing their functions, structures, and operations. It explains the roles of hardware, application programs, and users, and discusses various system architectures, including single-processor, multiprocessor, and clustered systems. Additionally, it covers process management, operating system services, and user interfaces, emphasizing the importance of resource allocation and system security.

Uploaded by

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

OPERATING

SYSTEM
CONCEPTS
ABRAHAM SILBERSCHATZ
Yale University
PETER BAER GALVIN
Pluribus Networks
GREG GAGNE
Westminster College
NINTH EDITION
Chapter 1 Introduction

1.1 What Operating Systems Do


1.3 Computer-System Architecture
1.4 Operating-System Structure
1.5 Operating-System Operations
1.6 Process Management

Chapter 2 Operating-System Structures

2.1 Operating-System Services


2.2 User and Operating-System
Interface
2.3 System Calls
2.4 Types of System Calls
2.5 System Programs
2.6 Operating-System Design and
Implementation
2.7 System Boot
1. Introduction
An operating system is a program that manages a computer’s hardware. It also
provides a basis for application programs and acts as an intermediary between the computer
user and the computer hardware.

Figure 1.1 Abstract view of the components of a computer system.

1.1 What Operating Systems Do

A computer system can be divided roughly into four components: the hardware, the
operating system, the application programs, and the users (Figure 1.1).

The hardware—the central processing unit (CPU), the memory and the input/output
(I/O) devices—provides the basic computing resources for the system.

The application programs—such as 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.
1.1.1 User View

The user’s view of the computer varies according to the interface being used. Most
computer users sit in front of a PC, consisting of a monitor, keyboard, mouse, and system
unit. Such a system is designed for one user to monopolize its resources. The goal is to
maximize the work that the user is performing.

In other cases, 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 to assure that all available CPU time, memory, and I/O are
used efficiently.

In still other cases, 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, including file, compute, and print
servers. Therefore, their operating system is designed to compromise between individual
usability and resource utilization.

1.1.2 System 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 that may be required to solve a problem: CPU time, memory space, file-
storage space, I/O 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.

1.1.3 Defining Operating Systems

Operating system covers many roles and functions. Computers are present within
toasters, cars, ships, spacecraft, homes, and businesses. They are the basis for game
machines, music players, cable TV tuners, and industrial control systems.

The fundamental goal of computer systems is to execute user programs and to make
solving user problems easier. Computer hardware is constructed toward this goal. Since bare
hardware alone is not particularly easy to use, application programs are developed. These
programs require certain common operations, such as those controlling the I/O devices. The
common functions of controlling and allocating resources are then brought together into one
piece of software: the operating system.

1.2 Computer-System Architecture

A computer system can be organized in a number of different ways, which we can


categorize according to the number of general-purpose processors used.
Figure 1.2 How a modern computer system works.

1.2.1 Single-Processor Systems

Most computer systems used a single processor. On a single processor system, there
is one main CPU capable of executing a general-purpose instruction set, including
instructions from user processes.

Almost all single processor systems have other special-purpose processors as well.
They may come in the form of device-specific processors, such as disk, keyboard and
graphics controllers.

If there is only one general-purpose CPU, then the system is a single-processor


system.

1.2.2 Multiprocessor Systems

Multiprocessor systems (also known as parallel systems or multicore systems) have


begun to dominate the landscape of computing. Such systems have two or more processors in
close communication, sharing the computer bus and sometimes the clock, memory, and
peripheral devices. Multiprocessor systems first appeared prominently appeared in servers
and have since migrated to desktop and laptop systems. Recently, multiple processors have
appeared on mobile devices such as smartphones and tablet computers.
Multiprocessor systems have three main advantages:

1. Increased throughput. By increasing the number of processors, we expect to get more


work done in less time.

2. Economy of scale. Multiprocessor systems can cost less than equivalent multiple single-
processor systems, because they can share peripherals, mass storage, and power supplies.

3. Increased reliability. 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 and one fails, then each of the remaining nine processors can pick up a share of
the work of the failed processor. Thus, the entire system runs only 10 percent slower, rather
than failing altogether.

The multiple-processor systems in use today are of two types. Some systems use
asymmetric multiprocessing, in which each processor is assigned a specific task. A boss
processor controls the system; the other processors either look to the boss for instruction or
have predefined tasks. This scheme defines a boss–worker relationship. The boss processor
schedules and allocates work to the worker processors.

The most common systems use symmetric multiprocessing (SMP), in which each
processor performs all tasks within the operating system. SMP means that all processors are
peers; no boss–worker relationship exists between processors.

Figure 1.3 Symmetric multiprocessing architecture.

1.2.3 Clustered Systems

Another type of multiprocessor system is a clustered system, which gathers together


multiple CPUs. Clustered systems differ from the multiprocessor systems . Each node may be
a single processor system or a multicore system. Clustered computers share storage and are
closely linked via a local-area network LAN or a faster interconnect, such as InfiniBand.

Clustering is usually used to provide high-availability service—that is, service will


continue even if one or more systems in the cluster fail. Clustering can be structured
asymmetrically or symmetrically. In asymmetric clustering, one machine is in hot-standby
mode while the other is running the applications. The hot-standby host machine does nothing
but monitor the active server. If that server fails, the hot-standby host becomes the active
server.

In symmetric clustering, two or more hosts are running applications and are
monitoring each other. This structure is obviously more efficient, as it uses all of the
available hardware. Since a cluster consists of several computer systems connected via a
network, clusters can also be used to provide high-performance computing environments.
Such systems can supply significantly greater computational power than single-processor or
even SMP systems because they can run an application concurrently on all computers in the
cluster.

Figure 1.4 General structure of a clustered system

1.3 Operating-System Structure

.
One of the most important aspects of operating systems is the ability to multiprogram.
A single program cannot, 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 so that the CPU


always has one to execute. The operating system keeps several jobs in memory
simultaneously. Since, 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. In a non-multiprogrammed system, the CPU would sit idle. In a multiprogrammed
system, the operating system simply switches to, and executes, another job.

When that job needs to wait, the CPU switches 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.

Multiprogrammed systems provide an environment in which the various system


resources (for example, 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. Time sharing
requires an interactive computer system, which provides direct communication between the
user and the system.

A time-shared operating system uses CPU scheduling and multiprogramming to


provide each user with a small portion of a time-shared computer. Each user has at least one
separate program in memory.

A program loaded into memory and executing is called a process. Time sharing and
multiprogramming require that several jobs be kept simultaneously in memory.

If several jobs are ready to be brought into memory, and if there is not enough room
for all of them, then the system must choose among them. Making this decision involves job
scheduling.

Memory layout for a multiprogramming system

1.4 Operating-System Operations

A trap (or an exception) is a software-generated interrupt caused either by an error


or by a specific request from a user program that an operating-system service be performed.
The interrupt-driven nature of an operating system defines that system’s general
structure. For each type of interrupt, separate segments of code in the operating system
determine what action should be taken. An interrupt service routine is provided to deal with
the interrupt.

1.4.1 Dual-Mode and Multimode Operation

In order to ensure the proper execution of the operating system, we must be able to
distinguish between the execution of operating-system code and user defined code. Two
separate modes of operation: user mode and kernel.

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.
When the computer system is executing on behalf of a user application, the system is
in user mode. At system boot time, the hardware starts in kernel mode. The operating system
is then loaded and starts user applications in user mode.

Whenever a trap or interrupt occurs, the hardware switches from user mode to kernel
mode. Thus, whenever the operating system gains control of the computer, it is in kernel
mode. The system always switches to user mode before passing control to a user program.

Transition from user to kernel mode.

1.4.2 Timer

A timer can be set to interrupt the computer after a specified period. The period may
be fixed or variable. A variable timer is generally implemented by a fixed-rate clock and a
counter.

The operating system sets the counter. Every time the clock ticks, the counter is
decremented. When the counter reaches 0, an interrupt occurs. For instance, a 10-bit counter
with a 1-millisecond clock allows interrupts at intervals from 1 millisecond to 1,024
milliseconds, in steps of 1 millisecond.

1.6 Process Management


 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

 Single-threaded process has one program counter specifying location of next


instruction to execute . Process executes instructions sequentially, one at a
time, until completion .

 Multi-threaded process has one program counter per thread . Typically system
has many processes, some user, some operating system running concurrently
on one or more CPUs

 Concurrency by multiplexing the CPUs among the processes .

The operating system is responsible for the following activities in connection with
process management:

 Creating and deleting both user and system processes

 Suspending and resuming processes.

 Providing mechanisms for process synchronization.

 Providing mechanisms for process communication.

 Providing mechanisms for deadlock handling

Chapter 2

2.1 OS Services

 One set of operating-system services provides functions that are helpful to the
user:

User interface :Almost all operating systems have a user interface (UI)

Varies between Command-Line (CLI), Graphics User Interface (GUI), Batch

 Program execution - The system must be able to load a program into memory
and to run that program, end execution, either normally or abnormally
(indicating error)

 I/O operations - A running program may require I/O, which may involve a file
or an I/O device
 File-system manipulation - The file system is of particular interest. Obviously,
programs need to read and write files and directories, create and delete them,
search them, list file Information, permission management.

 One set of operating-system services provides functions that are helpful to the
user (Cont):

 Communications – Processes may exchange information, on the same


computer or between computers over a network

 Communications may be via shared memory or through message passing


(packets moved by the OS)

 Error detection – OS needs to be constantly aware of possible errors

 May occur in the CPU and memory hardware, in I/O devices, in user program

 For each type of error, OS should take the appropriate action to ensure correct
and consistent computing

 Debugging facilities can greatly enhance the user’s and programmer’s abilities
to efficiently use the system

 Another set of OS functions exists for ensuring the efficient operation of the
system itself via resource sharing.

 Resource allocation - When multiple users or multiple jobs running


concurrently, resources must be allocated to each of them.

 Many types of resources - Some (such as CPU cycles, main memory, and file
storage) may have special allocation code, others (such as I/O devices) may
have general request and release code.

 Accounting - To keep track of which users use how much and what kinds of
computer resources .

 Protection and security - The owners of information stored in a multiuser or


networked computer system may want to control use of that information,
concurrent processes should not interfere with each other.

 Protection involves ensuring that all access to system resources is controlled.

 Security of the system from outsiders requires user authentication, extends to


defending external I/O devices from invalid access attempts.

 If a system is to be protected and secure, precautions must be instituted


throughout it. A chain is only as strong as its weakest link.
2.3 User and Operating-System Interface

1. Command Interpreters

 Some operating systems include the command interpreter in the kernel.

 Others, such asWindows 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 systems with multiple command interpreters to choose from, the


interpreters are known as shells.

 For example, on UNIX and Linux systems, a user may choose among several
different shells, including the Bourne shell, C shell, Bourne-Again shell, Korn
shell, and others.

 The main function of the command interpreter is to get and execute the next
user-specified command.

 Many of the commands given at this level manipulate files: create, delete,
list, print, copy, execute, and so on.

 The MS-DOS and UNIX shells operate in this way. These commands can be
implemented in two general ways.

 In one approach, the command interpreter itself contains the code to execute
the command.
.
 An alternative approach—used by UNIX, among other operating systems
implements most commands through system programs.
 the UNIX command to delete a file

rm file.txt

The Bourne shell command interpreter in Solrais 10.

2 Graphical User Interfaces

 A second strategy for interfacing with the operating system is through a user friendly
graphical user interface, or GUI.

 Here, rather than entering commands directly via a command-line interface, users
employ a mouse-based window and- menu system characterized by a desktop
metaphor.

 The user moves the mouse to position its pointer on images, or icons, on the screen
(the desktop) that represent programs, files, directories, and system functions.

 Depending on the mouse pointer’s location, clicking a button on the mouse can
invoke a program, select a file or directory—known as a folder—or pull down a menu
that contains commands.

 Microsoft’s first version of Windows—Version 1.0—was based on the addition of a


GUI interface to the MS-DOS operating system.
 Later versions of Windows have made cosmetic 60 changes in the appearance of the
GUI along with several enhancements in its functionality.

 A mouse is impractical for most mobile systems, smartphones and handheld tablet
computers typically use a touchscreen interface.

 Here, users interact by making gestures on the touchscreen—for example, pressing


and swiping fingers across the screen.

The iPad touchscreen.

3 Choice of Interface

 The choice of whether to use a command-line or GUI interface is mostly


one of personal preference.

 System administrators who manage computers and power users who have deep
knowledge of a system frequently use the command-line interface.
 For them, it is more efficient, giving them faster access to the activities they need to
perform.

 Most Windows users are happy to use the Windows GUI environment and almost
never use the MS-DOS shell interface.

 The various changes undergone by the Macintosh operating systems provide a nice
study in contrast.

 Mac OS has not provided a command-line interface, always requiring its users to
interface with the operating system using its GUI.

2.3 System Call

 Programming interface to the services provided by the OS

 Typically written in a high-level language (C or C++)

 Mostly accessed by programs via a high-level Application Program Interface (API)


rather than direct system call use.

 Three most common APIs are Win32 API for Windows, POSIX API for POSIX
based systems (including virtually all versions of UNIX, Linux, and Mac OS X), and
Java API for the Java virtual machine (JVM) .

Example: System call sequence to copy the contents of one file to another file

 Typically, a number associated with each system call.

 System-call interface maintains a table indexed according to these numbers.


 The system call interface invokes intended system call in OS kernel and returns status
of the system call and any return values .

 The caller need know nothing about how the system call is implemented.

 Just needs to obey API and understand what OS will do as a result call o Most details
of OS interface hidden from programmer by API.

 Managed by run-time support library (set of functions built into libraries included
with compiler).

2.4 Types of system call

 Process control

 File management

 Device management

 Information maintenance

 Communications

 Protection

Process control

◦ end, abort
◦ load, execute
◦ create process, terminate process
◦ get process attributes, set process attributes
◦ wait for time
◦ wait event, signal event
◦ allocate and free memory

File management

◦ create file, delete file


◦ open, close
◦ read, write, reposition
◦ get file attributes, set file attributes
Device management

◦ request device, release device


◦ read, write, reposition
◦ get device attributes, set device attributes
◦ logically attach or detach devices

Information maintenance

◦ get time or date, set time or date


◦ get system data, set system data
◦ get process, file, or device attributes
◦ set process, file, or device attributes

Communications

◦ create, delete communication connection


◦ send, receive messages
◦ transfer status information
◦ attach or detach remote devices
2.5 System Programs

 System programs, also known as system utilities, provide a convenient environment


for program development and execution.

 Some of them are simply user interfaces to system calls. Others are considerably
more complex. They can be divided into these categories:

• File management. These programs create, delete, copy, rename, print, dump, list, and
generally manipulate files and directories.

• Status information. Some programs simply ask the system for the date, time, amount of
available memory or disk space, number of users, or similar status information. Others are
more complex, providing detailed performance, logging, and debugging information.

• File modification. Several text editors may be available to create and modify the content of
files stored on disk or other storage devices. There may also be special commands to search
contents of files or perform transformations of the text.
• Programming-language support. Compilers, assemblers, debuggers, and interpreters for
common programming languages (such as C, C++, Java, and PERL) are often provided with
the operating systemor available as a separate download.

• Program loading and execution. Once a program is assembled or compiled, it must be


loaded into memory to be executed. The system may provide absolute loaders, relocatable
loaders, linkage editors, and overlay
loaders.

• Communications. These programs provide the mechanism for creating virtual connections
among processes, users, and computer systems. They allow users to send messages to one
another’s screens, to browse Web pages, to send e-mail messages, to log in remotely, or to
transfer files from one machine to another.

• Background services. All general-purpose systems have methods for launching certain
system-program processes at boot time. Some of these processes terminate after completing
their tasks, while others continue to run until the system is halted. Constantly running system-
program processes are known as services, subsystems.

2.6 Operating-System Design and Implementation

1. Design Goals

 The first problem in designing a system is to define goals and specifications.

 At the highest level, the design of the system will be affected by the choice of
hardware and the type of system: batch, time sharing, single user, multiuser,
distributed, real time, or general purpose.

 The requirements can, be divided into two basic groups:

 user goals and system goals.

 Users want certain obvious properties in a system. The system should be convenient
to use, easy to learn and to use, reliable, safe, and fast.

 A similar set of requirements can be defined by those people who must


design, create, maintain, and operate the system.

 The system should be easy to design, implement, and maintain; and it should be
flexible, reliable, error free, and efficient. Again, these requirements are vague and
may be interpreted in various ways.

2. Mechanisms and Policies

 One important principle is the separation of policy from mechanism.

 Mechanisms determine how to do something


 Policies determine what will be done.

 The separation of policy and mechanism is important for flexibility.

 Policies are likely to change across places or over time.

 Policy decisions are important for all resource allocation.

 Whenever it is necessary to decide whether or not to allocate a resource, a policy


decision must be made.

3. Implementation

 Once an operating system is designed, it must be implemented.

 Because operating systems are collections of many programs, written by many


people over a long period of time,

 It is difficult to make general statements about how they are implemented.

 Early operating systems were written in assembly language.

 Now, although some operating systems are still written in assembly language, most
are written in a higher-level language such as C or an even higher-level language such
as C++.

 An operating system can be written in more than one language. The lowest levels of
the kernel might be assembly language. Higher-level routines might be in C, and
system programs might be in C or C++, in interpreted scripting languages like PERL
or Python, or in shell scripts.

2.7 System Boot

 The procedure of starting a computer by loading the kernel is known as booting the
system.

 On most computer systems, a small piece of code known as the bootstrap program

 bootstrap loader locates the kernel, loads it into main memory, and starts its
execution.

 Some computer systems, such as PCs, use a two-step process in which a simple
bootstrap loader fetches a more complex boot program from disk,which in turn loads
the kernel.

 When a CPU receives a reset event—for instance, when it is powered up or rebooted


—the instruction register is loaded with a predefined memory location, and execution
starts there.
 At that location is the initial bootstrap program.

 This program is in the form of read-only memory (ROM), because the RAM is in an
unknown state at system startup.

 ROM is convenient because it needs no initialization and cannot easily be infected by


a computer virus.

 The bootstrap program can perform a variety of tasks.

 Usually, one task is to run diagnostics to determine the state of the machine. If the
diagnostics pass, the program can continue with the booting steps. It can also initialize
all aspects of the system.

 Storing the operating system in ROM is suitable for small operating systems, simple
supporting hardware, and rugged operation.

 A disk that has a boot partition is called a boot disk or system disk.

 The full bootstrap program has been loaded, it can traverse the file system to find the
operating system kernel, load it into memory, and start its execution. This is said to
be running.

You might also like