Chapter2 OS
Chapter2 OS
Chapter-2
CONTENTS:
* OBJECTIVES :-
● To explain how operating systems are installed
and customized and how they boot
OPERATING SYSTEM
SERVICES
❏ Operating systems provide an environment for execution of
programs and services to programs and users
❏ 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. Programs need to read and write files and directories,
create and delete them, search them, list file Information,
permission management.
❏ 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.
A View of Operating System Services
User Operating System Interface -
CLI
❏ GUI Elements
❏ Window tab
❏ Menu
❏ Item
❏ Cursor
CHOICES OF INTERFACES
● The choice of whether to use a CLI or GUI is mostly one if the personal
preference.
● As in case of repetitive task CLI is used, because they have their own
programmability.
Dual Modes Of
Operations
That’s why user mode is safer mode of operation and therefore most of the
programs run in user mode. But when a program is executing in user mode
then it may needs to be access to some of the resources then it makes a call
to OS telling that it needs to access certain resources. Then program switch
from user mode to kernel mode known as context switch.
SYSTEM CALLS
⮚ System call is the programmatic way in which a computer program request a
service from the kernel of the operating system it is executed on.
⮚ System calls always execute in system mode but API can also execute in user mode
⮚ System calls are also functions exposed by C library, so system calls also is an API
● Device management
●Device handling(I/O)
● 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 and set process, file, or device attributes
● Communications
● create, delete communication connection
● send, receive messages if message passing
model to host name or process name
4 From client to server
● Shared-memory model create and gain access
to memory regions
● transfer status information
● attach and detach remote devices
● Protection
● Control access to resources
● Get and set permissions
● Allow and deny user access
System Programs
⮚ System Programs provide a convenient environment for program development
and execution. Some of them are simply user interface to system calls . Others
are considerably more complex.
● System programs provide a convenient environment for
program development and execution. They can be divided
into:
● File manipulation
● Status information sometimes stored in a File
modification
● Programming language support
● Program loading and execution
● Communications
● Background services
● Application programs
● Status information
● Some ask the system for info - date, time, amount of
available memory, disk space, number of users
● Others provide detailed performance, logging, and
debugging information
● Typically, these programs format and print the output to
the terminal or other output devices
● Some systems implement a registry - used to store and
retrieve configuration information
● File modification
● Text editors to create and modify files
● Special commands to search contents of files or perform
transformations of the text
⮚ Operating system can be implemented with the help of various structures. The
structure of the OS depends mainly on how the various common components of
the operating system are interconnected and melded into the kernel.
Simple
⮚ Such operating systems do not have well defined structure and are small, simple
and limited systems. structure
⮚ The interfaces and levels of functionality are not well separated
Advantages :
⮚ The execution of the monolithic kernel is quite fast as the services such as
memory management, file management, process scheduling etc.are
implemented under the same address space.
⮚ A process runs completely in a single address space in the monolithic
kernel.
⮚ The monolithic kernel is a static single binary file.
Disadvantages :
⮚ If any service fails in the monolithic kernel, it leads to the failure of the
entire system.
⮚ To add any new service, the entire operating system needs to be modified
by the user.
Layered structure
⮚ Another approach is to break the
OS into a number of smaller layers,
each of which rests on the layer
below it, and relies solely on the
services provided by the next
lower layer.
Advantages:
⮚ Easy debugging and system verification.
⮚ Allows good maintenance
Microkernel System
Structure
● Moves as much from the kernel into user space
● Mach example of microkernel
● Mac OS X kernel (Darwin) partly based on Mach
● Benefits:
● Easier to extend a microkernel
● Easier to port the operating system to new architectures
● More reliable (less code is running in kernel mode)
● More secure
● Detriments:
● Performance overhead of user space to kernel space
communication
Microkernel System Architecture
MODULES
● Most 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 flexible
● Linux, Solaris, etc
Solaris Modular Approach
System Boot
⮚ Every time the CS is switched on, a copy of an essential part of OS is brought into
the main memory from the hard disk. This essential part is called as monitor
program. The monitor starts executing. Hence the process of bringing the monitor
program into the main memory and executing is known as booting.
⮚ A small program called the BIOS is permanently stored in the ROM, capable of
performing input and output operations on the I/O devices .
⮚ When the computer is switched on, the CPU generates the address of the
memory locations where the BIOS is stored(in the ROM) and the BIOS starts
executing.
⮚ The BIOS picks up a copy of boot program from the boot sector of the disk
and loads it into RAM. Thereafter, the BIOS transfers control to the boot
program, and execution begins.
⮚ The boot program takes control of CS and provides a user interface and on
user’s request it loads the application programs and required components of
OS an the RAM on need-felt basis.