Unformatted text preview:

Basic Operating System ConceptsMain Goals of OSSystem CallSome UNIX System CallsExecution Modes (Dual Mode Execution)Mode SwitchingProcessing a System Call*Review TopicsReview of ProcessesProcess DefinitionProcesses: Process ImageProcess Execution StatesProcess State Transition DiagramPowerPoint PresentationContext Switch (sometimes called process switch)Concurrent ProcessesForms of ConcurrencyProtectionProcesses and ThreadsThreadsThreads versus ProcessesSlide 22Process (Thread) SchedulingScheduling Algorithms:Scheduling GoalsSlide 26Interprocess Communication (IPC)Process/Thread SynchronizationSlide 29Process Synchronization – 2 TypesMutual ExclusionSynchronizationSemaphoresOther Mechanisms for Mutual ExclusionDeadlockDeadlock versus StarvationCauses of DeadlockDeadlock Management StrategiesAnalysis of Deadlock ManagementSlide 40Memory ManagementMemory Management - IntroAllocation Methods: Single ProcessAllocation Methods: Multiple Processes, Contiguous AllocationAllocation Methods: Multiple Processes, Virtual MemoryVirtual Memory - PagingPaging - continuedSolutions to Paging ProblemsOS Responsibilities in Paged Virtual MemorySlide 50File SystemsFile Systems – Disk ManagementSlide 53Basic Operating System ConceptsA ReviewMain Goals of OS1. Resource Management: Disk, CPU cycles, etc. must be managed efficiently to maximize overall system performance2. Resource Abstraction: Software interface to simplify use of hardware resources3. Virtualization: Supports resource sharing – gives each process the appearance of an unshared resourceSystem Call •An entry point to OS code•Allows users to request OS services•API’s/library functions usually provide an interface to system calls–e.g, language-level I/O functions map user parameters into system-call format•Thus, the run-time support system of a prog. language acts as an interface between programmer and OS interfaceSome UNIX System Calls•System calls for low level file I/O –creat(name, permissions) –open(name, mode) –close(fd) –unlink(fd) –read(fd, buffer, n_to_read) –write(fd, buffer, n_to_write) –lseek(fd, offest, whence) •System Calls for process control –fork() –wait() –execl(), execlp(), execv(), execvp() –exit() –signal(sig, handler) –kill(sig, pid) •System Calls for IPC –pipe(fildes) –dup(fd)Execution Modes(Dual Mode Execution)•User mode vs. kernel (or supervisor) mode•Protection mechanism: critical operations (e.g. direct device access, disabling interrupts) can only be performed by the OS while executing in kernel mode•Mode bit•Privileged instructionsMode Switching•System calls allow boundary to be crossed–System call initiates mode switch from user to kernel mode–Special instruction – “software interrupt” – calls the kernel function •transfers control to a location in the interrupt vector–OS executes kernel code, mode switch occurs again when control returns to user processProcessing a System Call*•Switching between kernel and user mode is time consuming•Kernel must–Save registers so process can resume execution•Other overhead is involved; e.g. cache misses, & prefetch –Verify system call name and parameters–Call the kernel function to perform the service–On completion, restore registers and return to callerReview Topics•Processes &Threads•Scheduling•Synchronization•Memory Management•File and I/O ManagementReview of Processes•Processes–process image–states and state transitions–process switch (context switch)•Threads •ConcurrencyProcess Definition•A process is an instance of a program in execution.•It encompasses the static concept of program and the dynamic aspect of execution.•As the process runs, its context (state) changes – register contents, memory contents, etc., are modified by executionProcesses: Process Image•The process image represents the current status of the process•It consists of (among other things)–Executable code–Static data area–Stack & heap area –Process Control Block (PCB): data structure used to represent execution context, or state–Other information needed to manage processProcess Execution States•For convenience, we describe a process as being in one of several basic states.•Most basic:–Running–Ready–Blocked (or sleeping)Process State Transition Diagramreadyrunningblockedpreemptdispatchwait for eventevent occursOther States•New•Exit•Suspended (Swapped)–Suspended blocked–Suspended readyContext Switch(sometimes called process switch)•A context switch involves two processes:–One leaves the Running state–Another enters the Running state•The status (context) of one process is saved; the status of the second process restored.•Don’t confuse with mode switch.Concurrent Processes•Two processes are concurrent if their executions overlap in time.•In a uniprocessor environment, multiprogramming provides concurrency.•In a multiprocessor, true parallel execution can occur.Forms of Concurrency Multi programming: Creates logical parallelism by running several processes/threads at a time. The OS keeps several jobs in memory simultaneously. It selects a job from the ready state and starts executing it. When that job needs to wait for some event the CPU is switched to another job. Primary objective: eliminate CPU idle timeTime sharing: An extension of multiprogramming. After a certain amount of time the CPU is switched to another job regardless of whether the process/thread needs to wait for some operation. Switching between jobs occurs so frequently that the users can interact with each program while it is running. Multiprocessing: Multiple processors on a single computer run multiple processes at the same time. Creates physical parallelism.Protection •When multiple processes (or threads) exist at the same time, and execute concurrently, the OS must protect them from mutual interference.•Memory protection (memory isolation) prevents one process from accessing the physical address space of another process.•Base/limit registers, virtual memory are techniques to achieve memory protection.Processes and Threads•Traditional processes could only do one thing at a time – they were single-threaded.•Multithreaded processes can (conceptually) do several things at once – they have multiple threads.•A thread is an “execution context” or “separately schedulable” entity.Threads•Several threads can share the address space of a


View Full Document

UAH CS 690 - Basic Operating System

Download Basic Operating System
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Basic Operating System and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Basic Operating System 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?