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

M1

Uploaded by

gaya3 sankar
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)
18 views

M1

Uploaded by

gaya3 sankar
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/ 64

MODULE I

Introduction: Operating system overview – Operations, Functions, Service –


System calls, Types –
Operating System structure - Simple structure, Layered approach, Microkernel,
Modules
– System boot process.
Operating System: Overview
• An operating system acts as an intermediary between the user of a
computer and the computer hardware.
• The purpose of an operating system is to provide an environment in
which a user can execute programs in a convenient and efficient
manner.
• An operating system is software that manages the computer
hardware.
• Operating systems are varied in accomplishing the 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
• efficient
• Convenient+ efficient
Abstract view of the components of a computer system
A computer system can be divided roughly into four components:
1. Hardware:
• CPU, memory, I/O devices
• Provides the basic computing resources for the system
2. Application programs :
• word processors/ spreadsheets/ compilers, and Web browsers
• define the ways in which these resources are used to solve users' computing
problems.
3.Operating system:
• controls the hardware and coordinates its use among the various application
programs for the various users.
4.Users
Functions of an Operating System
• Process Management
• Memory Management
• Mass Storage Management
• File System Management
• Device Management
• Protection and Security
• Other important functions
Process Management
• A process is a program in execution
• Process scheduling:
• OS decides which process gets the processor when and for how
much time.
• multiprogramming environment(several programs run at the same time)
• An Operating System does the following activities for processor management:
• OS allocates the processor (CPU) to a process and also de-allocates processor
when a process is no longer required.
• OS keeps tracks of processor and status of process.
• Creating and deleting processes
• Suspending and resuming processes
• Providing mechanisms for process synchronization, process communication
and deadlock handling
Memory Management
• 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
• OS manages the memory by allocating main memory to different
process currently under the execution.
• 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
Mass-Storage Management
• Problems with main memory:
• Main memory is too small to accommodate all data and
programs
• When power is lost, the data that it hold are lost
• So secondary storage devices are used to back up the main
memory
• disk
• Mass-Storage management activities:
• Free-space management
• Storage allocation
• Disk scheduling
File System Management
• A file is a collection of related information.
• A file can be a text file, image, audio, video or may contain data in
any other form.
• A file system is normally organized into directories for easy
navigation and usage.
An Operating System does the following activities for file
management:
• Creating and deleting files
• Creating and deleting directories to organize files
• Supporting primitives for manipulating files and directories
• Mapping files onto secondary storage
• Backing up files on stable (nonvolatile) storage media
Device Management
• An Operating System manages device communication via their
respective drivers.
• It does the following activities for device management:
• Keeps track of all devices
• Decides which process gets the device when and for how much time.
• Allocates the device in the efficient way.
• De-allocates devices.
Protection and Security
• If a computer system has multiple users and allows the concurrent execution of multiple
processes, then access to data must be regulated.
• Only authorized users/processes must access data.
• Protection
• any mechanism for controlling access of processes or users to the resources defined by the
OS
• Security
• defense of the system against internal and external attacks

• By means of password and similar other techniques, it prevents unauthorized access to


programs and data.
• Protection and security require the system to be able to distinguish among all its users.
• Most operating systems maintain a list of user names and associated user identifiers
(user IDs).
Other Important Functions
• Following are some other important functions of OS:
• Control over system performance
• Recording delays between request for a service and response from the system.
• Job accounting
• Keeping track of time and resources used by various jobs and users.
• Coordination between other software's and users
• Coordination and assignment of compilers, interpreters, assemblers and other software to
the various users of the computer systems.
Kernel in Operating System
• A Kernel is a computer program that is the heart and core of an
Operating System.
• Whenever a system starts, the Kernel is the first program that is
loaded
• The Kernel remains in the memory until the Operating System is shut-
down.
System Boot Process
• the bootstrap program must locate the operating-system kernel and
load it into memory.
• it is stored within the computer hardware in read-only memory
(ROM) or electrically erasable programmable read-only memory
(EEPROM)
• Once the kernel is loaded and executing, it can start providing
services to the system and its users.
• On UNIX, the first system process is “init,” and it starts many other
background process.
• Once this phase is complete, the system is fully booted, and the
system waits for some 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 (also called a monitor call).
Operating-System Operation
• Dual-Mode 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
• kernel mode (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).
1.User Mode
• A task that is executed on behalf of the user
2.Kernel mode
• A task that is executed on behalf of the operating system
Transition from user to kernel mode
• when a user application requests a service from the operating system
(via a system call), the system must transition from user to kernel
mode to fulfill the request.
System Calls
• System calls provide an interface to the services made available by an
operating system.
• Or a system call is the programmatic way in which a computer
program requests a service from the kernel of the operating system
• A system call is a way for programs to interact with the operating
system
• System calls are the only entry points into the kernel system
• These calls are generally available as routines written in C and C++
An example to illustrate how system calls are used:
writing a simple program to read data from one
file and copy them to another file
• An example to illustrate how system calls are used: writing a simple
program to read data from one file and copy them to another file
Types of System Calls
Grouped into five major categories:
1. Process control
2. File manipulation
3. Device manipulation
4. Information maintenance
5. Communications
Process attributes
Operating-System Services
• An operating system provides an environment for the execution of
programs.
• It provides certain services to programs and to the users of those
programs.
• The specific services provided, of course, differ from one operating
system to another, but we can identify common classes.
• These operating system services are provided for the convenience of
the programmer, to make the programming task easier.
• One set of operating system services provides functions that are
helpful to the user.
It includes:
1. User Interface
2. Program Execution
3. I/O Operations
4. File system manipulation
5. Communications
6. Error Detection
1. User interface
• Almost all operating systems have a user interface (UI).
• This interface can take several forms:
a. command-line interface (CLI)
• uses text commands and a method for entering them (say, a keyboard for typing in
commands in a specific format with specific options).
b. batch interface
• commands and directives to control those commands are entered into files, and those
files are executed
c. graphical user interface (GUI)
• Most commonly, a graphical user interface (GUI) is used.
• interface is a window system with a pointing device to direct I/O, choose from menus,
and make selections and a keyboard to enter text.
Some systems provide two or all three of these variations.
2. Program execution
• The system must be able to load a program into memory and to run
that program.
• The program must be able to end its execution, either normally or
abnormally (indicating error).
3. I/O operations
• A running program may require I/O, which may involve a file or an I/O
device.
• For specific devices, special functions may be desired (such as
recording to a CD or DVD drive or blanking a display screen).
• For efficiency and protection, users usually cannot control I/O devices
directly.
• Therefore, the operating system must provide a means to do I/O.
4. File-system manipulation
• need to:
• read and write files and directories.
• need to create and delete files and directories by name,
• search for a given file
• list file information.
• include permissions management to allow or deny access to files or
directories based on file ownership.
5. Communications
• one process needs to exchange information with another process.
• occur between processes that are executing on the same computer or
between processes that are executing on different computer systems
tied together by a computer network.
• Communications may be implemented by two ways:
• shared memory :two or more processes read and write to a shared section of
memory
• message passing: packets of information in predefined formats are moved
between processes by the operating system.
6. Error detection
• Needs to detect and correct errors constantly
• Errors may occur in:
• the CPU and memory hardware (such as a memory error or a power failure),
• in I/O devices (a connection failure on a network, or lack of paper in the printer)
• in the user program (such as an arithmetic overflow, an attempt 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.
• Sometimes, it has no choice but to halt the system.
• At other times, it might terminate an error-causing process or return an error code to
a process for the process to detect and possibly correct.
• Another set of operating system functions exists for ensuring the
efficient operation of the system itself:
a) Resource allocation.
b) Accounting.
c) Protection and security
a. Resource allocation
• When there are multiple users or multiple jobs running at the same time,
resources must be allocated to each of them.
• The operating system manages many different types of resources.
For instance:
• in determining how best to use the CPU:
• operating systems have CPU-scheduling routines that take into account the speed of
the CPU,
• the jobs that must be executed,
• the number of registers available, and other factors.
• routines to allocate printers, USB storage drives, and other peripheral
devices.
b. Accounting
• We want to keep track of which users use how much and what kinds
of computer resources.
• This record keeping may be used for accounting (so that users can be
billed) or simply for accumulating usage statistics.
• Usage statistics may be a valuable tool for researchers who wish to
reconfigure the system to improve computing services.
c. Protection and security
• The owners of information stored in a multiuser or networked computer
system may want to control use of that information.
• When several separate processes execute concurrently, it should not be
possible for one process to interfere with the others or with the operating
system itself.
• Protection involves ensuring that all access to system resources is
controlled.
• Security of the system from outsiders is also important.
• security starts with requiring each user to authenticate himself or herself
to the system, usually by means of a password, to gain access to system
resources.
Operating-System Structure
• how the operating system components are interconnected and
melded into a kernel.
• Various ways to structure OS:
• Simple structure
• Monolithic
• Layered
• Microkernel
• Modular
Simple Structure
• do not have well-defined structures.
• small, simple, and limited systems
• MS-DOS is an example of such a system
• In MS-DOS, the interfaces and levels of functionality are not well
separated.
• 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
• no dual mode and no hardware protection
Monolithic structure
• Earlier UNIX system
• 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.
• 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.
• Taken in sum, that is an enormous amount of functionality to be combined
into one level.
• This monolithic structure was difficult to implement and maintain.
Layered Approach
• the operating system is broken into a number of layers (levels).
• The bottom layer (layer 0) is the hardware, the highest (layer N) is the
user interface.
• A typical operating-system layer M, consists of data structures and a
set of routines that can be invoked by higher-level layers.
• Layer M, in turn, can invoke operations on lower-level layers.
• Advantage: simplicity of construction and
debugging.
• Disadvantage: appropriately defining the various layers.
Because a layer can use only lower-level layers, careful
planning is necessary.
Microkernel
• Microkernel(smaller kernel) :structures the operating system by
removing all nonessential components from the kernel and
implementing them as system and user-level programs.
• microkernels provide:
• minimal process and memory management
• a communication facility
• main function of the microkernel is to provide communication
between the client program and the various services that are also
running in user space.
• Advantage:
• it makes extending the operating system easier.
• All new services are added to user space and consequently do not
require modification of the kernel
• The resulting operating system is easier to port from one hardware
design to another.
• provides more security and reliability
• since most services are running as user rather than kernel processes.
• If a service fails, the rest of the operating system remains untouched
Modules
• Many modern operating systems implement loadable kernel modules
• Uses object-oriented approach
• Each core component is separate
• Each talks to the others over known interfaces
• Each is loadable as needed within the kernel
• Overall, similar to layers but with more flexibility
• Linux, Solaris, etc
Solaris Modular Approach
Tutorial 1
❑Batch OS
❑Multitasking/Time Sharing OS
❑Multiprocessing OS
❑Distributed OS
❑Real Time OS
❑Network OS
❑Mobile OS

You might also like