38
Basic concepts of OS OS Structures G.Anuradha

Basic concepts of OS OS Structures

  • Upload
    shayla

  • View
    71

  • Download
    14

Embed Size (px)

DESCRIPTION

Basic concepts of OS OS Structures. G.Anuradha. Basic concepts of OS. Processes Deadlocks Memory management Input/output Files Security. Processes. Process is a program in execution Associated with each process we have Address space (executable program+data+stack) - PowerPoint PPT Presentation

Citation preview

Page 1: Basic concepts of OS OS Structures

Basic concepts of OSOS Structures

G.Anuradha

Page 2: Basic concepts of OS OS Structures

Basic concepts of OS

• Processes• Deadlocks• Memory management• Input/output• Files• Security

Page 3: Basic concepts of OS OS Structures

Processes

• Process is a program in execution• Associated with each process we have

– Address space (executable program+data+stack)– List of memory locations (with max and min

memory locations)– Registers(stack pointer, program counter,

hardware registers)– Eg: Time Sharing System

Page 4: Basic concepts of OS OS Structures

Processes Contd.

• Whenever a process is suspended temporarily the current state of the process is stored in a process table.

• Interprocess communication is the Communication between different interrelated process

• When communicating between processes of different computers a alarm signal is send to notify lost messages.

Page 5: Basic concepts of OS OS Structures

Processes Contd.

• In UNIX processes, every user who logs in has a Unique Identification (UID).

• Every process started has the UID of the person who started it

• A child process has the UID as that of parent• Members of the same group can have Group

Identification(GID)• One UID called Superuser has all the

administrative powers.

Page 6: Basic concepts of OS OS Structures

Deadlocks

Page 7: Basic concepts of OS OS Structures

Deadlocks Contd…

• When two or more processes are interacting, they can sometimes get themselves into a stalemate situation they cannot get out of. Such a situation is called a deadlock.

• Processes in a computer can experience an analogous situation in which they cannot make any progress

Page 8: Basic concepts of OS OS Structures

Memory Management

• Main memory holds the executing program• In simple OS only one executing program

resides in the main memory• In sophisticated OS more than one executing

program can reside in memory• To prevent them from interfering with each

our some protection mechanism has to be provided by the OS

Page 9: Basic concepts of OS OS Structures

Memory Management Contd…

• Managing the address space of the processes.• The executable program address space is less

than the main memory address space for the program to reside in the memory

• If the program address space is more than main memory address space a concept of virtual memory is used

• Virtual Memory-OS keeps part of address space in memory and part in disk and shuttles between both

Page 10: Basic concepts of OS OS Structures

Input/Output

• OS has to manage the input output devices like keyboards, monitors, printers….

• Every OS has I/O subsystem for managing the I/O devices

• Some I/O software are device independent but some device drivers are specific to particular I/O devices

Page 11: Basic concepts of OS OS Structures

Files

• One major function of the OS is to hide the peculiarities of the disks and other I/O devices and present the programmer with a nice, clean abstract model of device-independent files

• System calls are needed – create files– remove files– read files– write files.

Page 12: Basic concepts of OS OS Structures

Files Contd…

• OS has a concept of directory for grouping files together(UNIX) the path for file CS101 is

/Faculty/Prof.Brown/Courses/CS101.

Page 13: Basic concepts of OS OS Structures

Files Contd…

• Every file within the directory hierarchy is specified by its path name from the root directory.

• Each process has a current working directory• Before a file can be read or written, it must be

opened, at which time the permissions are checked

• If permitted the system returns a file descriptor else an error code is returned

Page 14: Basic concepts of OS OS Structures

Special Files

• Special files are provided in order to make I/O devices look like files.

• Two kinds of special files exist– block special files :- used to model devices that

consist of a collection of randomly addressable blocks (disks)

– character special files:-used to model printers, modems, and other devices that accept or output a character stream.

Page 15: Basic concepts of OS OS Structures

Pipes

•A pipe is a sort of pseudofile that can be used to connect two processes•If processes A and B wish to talk using a pipe, they must set it up in advance.•When process A wants to send data to process B, it writes on the pipe as though it were an output file.•Process B can read the data by reading from the pipe as though it were an input file.

Page 16: Basic concepts of OS OS Structures

Security• OS has to manage the system security so that files, are

accessible to authorized users.• In UNIX security is provided by 9-bit binary protection

code• The protection code consists of three 3-bit fields

– Owner– Members of the owner’s group– Everyone

• rwxr-x--x – r read– w write– x execute

Page 17: Basic concepts of OS OS Structures

Shells(exclusive for UNIX)

• OS carries out system calls• Although Shells are not part of OS it makes

use of many OS Features• When user logs in a shell is started • Shell has terminal as standard input and

standard output• It starts out by typing the prompt, a character

such as a dollar sign, which tells the user that the shell is waiting to accept a command

Page 18: Basic concepts of OS OS Structures

OS-Structure • Simple structure• Layered approach• Microkernels• modules

Page 19: Basic concepts of OS OS Structures

Simple Structure

• Do not have a well-defined structure• 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

Page 20: Basic concepts of OS OS Structures

MS-DOS Layer Structure(Simple Structure)

initially written to provide the most functionality in the least space

started small and grew beyond its original scope

levels not well separated: programs could access I/O devices directly

excuse: the hardware of that time was limited (no dual user/kernel mode)

Page 21: Basic concepts of OS OS Structures
Page 22: Basic concepts of OS OS Structures

Simple Layered Approach(UNIX)

• Enormous functionality crammed into the kernel below the system call interface

• No encapsulation but total visibility across system

• Made of thick monolithic layers

More functionality combined into one level system call interface to the kernel

Page 23: Basic concepts of OS OS Structures

Fully Layered Approach• The operating system is divided into a

number of layers (levels), each built on top of lower layers.

• The bottom layer (layer 0), is the hardware; The highest (layer N) is the user interface.

• With modularity, layers are selected such that each uses functions (operations) and services of only lower-level layers

• THE system (by Dijkstra), MULTICS, GLUnix, VAX/VMS

Page 24: Basic concepts of OS OS Structures
Page 25: Basic concepts of OS OS Structures
Page 26: Basic concepts of OS OS Structures
Page 27: Basic concepts of OS OS Structures
Page 28: Basic concepts of OS OS Structures
Page 29: Basic concepts of OS OS Structures
Page 30: Basic concepts of OS OS Structures
Page 31: Basic concepts of OS OS Structures
Page 32: Basic concepts of OS OS Structures

Solaris Modular Approach

Advantages :- 1.More flexible than a layered system2.More efficient than the micro kernel approach because there is no message passing

Page 33: Basic concepts of OS OS Structures
Page 34: Basic concepts of OS OS Structures

Mac OS X Structure

•Uses a hybrid structure•Mach provides

•Memory management•Remote Procedure Calls•Interprocess communication facilities•Thread Scheduling

•BSD(Berkeley Software Distribution) provides

•Command line interface•Support for networking and file systems•Implementation of POSIX API

Page 35: Basic concepts of OS OS Structures

Types of OS:

Operating System can also be classified as,-

• Single User Systems

• Multi User Systems

Page 36: Basic concepts of OS OS Structures

Single User Systems:

• Provides a platform for only one user at a time.

• They are popularly associated with Desk Top operating system which run on standalone systems where no user accounts are required.

• Example: DOS

Page 37: Basic concepts of OS OS Structures

Multi-User Systems:

• Provides regulated access for a number of users by maintaining a database of known users.

• Refers to computer systems that support two or more simultaneous users.

• Another term for multi-user is time sharing.

• Ex: All mainframes and are multi-user systems.• Example: Unix

Page 38: Basic concepts of OS OS Structures

University Questions• What are system calls and its types• Difference between monolithic and micro kernel• What is kernel and how do u design it?• Short notes on monitor• What is shared memory? Difference between shared memory and

message passing• What are the various system calls for process management• Services provided by OS