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

OS Unit 1 Part 2

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

OS Unit 1 Part 2

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/ 23

Unit 1

Part 2
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
Operating System Services (Cont.)
• One set of operating-system services provides functions that are helpful to the user
(Cont.):
• 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
Operating System Services (Cont.)
• 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 - CPU cycles, main memory, file storage, I/O
devices.
• 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
A View of Operating System Services
User Operating System Interface - CLI

CLI or command interpreter allows direct


command entry
• Sometimes implemented in kernel, sometimes by
systems program
• Sometimes multiple flavors implemented – shells
• Primarily fetches a command from user and
executes it
• Sometimes commands built-in, sometimes just
names of programs
• If the latter, adding new features doesn’t require shell
modification
Types of System Calls
• Process control
• create process, terminate process
• end, abort
• load, execute
• get process attributes, set process attributes
• wait for time
• wait event, signal event
• allocate and free memory
• Dump memory if error
• Debugger for determining bugs, single step execution
• Locks for managing access to shared data between
processes
Types of System Calls

• File management
• create file, delete file
• open, close file
• read, write, reposition
• get and set file attributes
• Device management
• request device, release device
• read, write, reposition
• get device attributes, set device attributes
• logically attach or detach devices
Types of System Calls (Cont.)
• 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
• From client to server
• Shared-memory model create and gain access to
memory regions
• transfer status information
• attach and detach remote devices
Types of System Calls (Cont.)

• Protection
• Control access to resources
• Get and set permissions
• Allow and deny user access
Examples of Windows and Unix System Calls
Operating System Structure
• General-purpose OS is very large program
• Various ways to structure ones
• Simple structure – MS-DOS
• More complex -- UNIX
• Layered – an abstrcation
• Microkernel -Mach
Simple Structure -- MS-DOS
• MS-DOS – written to
provide the most
functionality in the least
space
• Not divided into
modules
• Although MS-DOS has
some structure, its
interfaces and levels of
functionality are not
well separated
Monolithic Kernel
• A monolithic kernel is an operating system architecture where the
entire operating system is working in kernel space.
• The monolithic model differs from other operating system
architectures (such as the microkernel architecture)in that it alone
defines a high-level virtual interface over computer hardware.
• A set of primitives or system calls implement all operating system
services such as process management, concurrency, and memory
management. Device drivers can be added to the kernel as modules.
Example of Monolithic kerenel Non Simple
Structure -- UNIX
UNIX – limited by hardware functionality, the original UNIX
operating system had limited structuring. The UNIX OS
consists of two separable parts
• Systems programs
• The kernel
• Consists of everything below the system-call interface and above the physical
hardware
• Provides the file system, CPU scheduling, memory management, and other
operating-system functions; a large number of functions for one level
Traditional UNIX System Structure
Beyond simple but not fully layered
Layered Approach
• 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.
• This approach allows each layer to be developed and
debugged independently, with the assumption that all
lower layers have already been debugged and are
trusted to deliver proper services.
• The problem is deciding what order in which to place the
layers, as no layer can call upon the services of any
higher layer, and so many chicken-and-egg situations
may arise.
• Layered approaches can also be less efficient, as a
request for service from a higher layer has to filter
through all lower layers before it reaches the HW,
possibly with significant processing at each step.
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
• Communication takes place between user
modules using message passing
• 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 Structure
Application File Device user
Program System Driver mode

messages messages

Interprocess memory CPU kernel


Communication managment scheduling mode

microkernel

hardware
Difference between microkerenel and
Monolithic kernel
Reentrant Function
• A function is said to be reentrant if there is a provision to interrupt
the function in the course of execution, service the interrupt service
routine and then resume the earlier going on function, without
hampering its earlier course of action. Reentrant functions are used in
applications like hardware interrupt handling, recursion, etc.
Re-entrant Kernel
• A re-entrant kernel enables processes (or, to be more precise, their
corresponding kernel threads) to give away the CPU while in kernel mode.
• They do not hinder other processes from also entering kernel mode. A
typical use case is IO wait.
• The process wants to read a file. It calls a kernel function for this. Inside the
kernel function, the disk controller is asked for the data. Getting the data
will take some time and the function is blocked during that time.
• With a re-entrant kernel, the scheduler will assign the CPU to another
process (kernel thread) until an interrupt from the disk controller indicates
that the data is available and our thread can be resumed.
• This process can still access IO (which needs kernel functions), like user
input. The system stays responsive and CPU time waste due to IO wait is
reduced.
What is the concept of reentrancy?

• It is a very useful memory saving technique that is used for multi-


programmed time sharing systems. It provides functionality that
multiple users can share a single copy of program during the same
period.
• It has two key aspects:
• The program code cannot modify itself.
• The local data for each user process must be stored separately.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy