Docsity

CMSC 412 Lecture 3: System Calls and Processes - Prof. Jeffrey K. Hollingsworth, Study notes of Operating Systems

Partial preview of the text

Download CMSC 412 Lecture 3: System Calls and Processes - Prof. Jeffrey K. Hollingsworth and more Study notes Operating Systems in PDF only on Docsity!

  • S02 (lect 3)

Announcements

l

Program #1^ – Is on the web

l

Reading^ – Chapter 3– Chapter 4 (for Thursday)

  • S02 (lect 3)

System Calls

l

Provide the interface between application programsand the kernel

l

Are like procedure calls^ – take parameters– calling routine waits for response

l

Permit application programs to access protectedresources

load r0, xsystem call 10User Program

Operating System

Code forsys call 10 (kernel)

register r

  • S02 (lect 3)

Types of System Calls

l

File Related^ –

open, create

-^

read, write

-^

close, delete

-^

get or set file attributes

l

Information^ –

get time

-^

set system data (OS parameters)

-^

get process information (id, time used)

l

Communication^ –

establish a connection

-^

send, receive messages

-^

terminate a connection

l

Process control^ –

create/terminate a process (including self)

  • S02 (lect 3)

System Structure

l

Simple Structure (or no structure)^ – any part of the system may use the functionality of the rest of

the system

  • MS-DOS (user programs can call low level I/O routines)

l

Layered Structure^ – layer n can only see the functionality that layer n-1 exports– provides good abstraction from the lower level details

  • new hardware can be added if it provides the interface

required of a particular layer

  • system call interface is an example of layering– can be slow if there are too many layers

l

Hybrid Approach^ – most real systems fall somewhere in the middle

  • S02 (lect 3)

Processes

l

What is a process?^ – a program in execution– “An execution stream in the context of a particular state”– a piece of code along with all the things the code can affect

or be affected by.

  • this is a bit too general. It includes all files and

transitively all other processes

  • only one thing happens at a time within a process

l

What’s not a process?– program on a disk - a process is an active object, but a

program is just a file

  • S02 (lect 3)

Multi-programming

l

Systems that permit more than one process at once^ – virtually all computers today

l

Permits more efficient use of resources^ – while one process is waiting another can run

l

Provides natural abstraction of different activities^ – windowing system– editor– mail daemon

l

Preemptive vs. non-preemptive muti-programming^ – preemptive means that a process can be forced off the

processor by the OS

  • provides processor protection
  • S02 (lect 3)

Process State Transitions

new

readyready

runningrunning

waitingwaiting

terminatedterminated

admitted

interrupt dispatch

I/O request or event wait

I/O request orevent wait done

Kill

exit

  • S02 (lect 3)

Components of a Process

l

Memory Segments^ – Program - often called the text segment– Data - global variables– Stack - contains activation records

l

Processor Registers^ – program counter - next instruction to execute– general purpose CPU registers– processor status word

  • results of compare operations
    • floating point registers