Operating Systems: Processes

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

Which of the following is NOT a primary role of the operating system (OS)?

  • Facilitating direct hardware access for applications. (correct)
  • Ensuring resource protection.
  • Providing a convenient interface for applications.
  • Managing system resources.

Which of the following best describes a process in the context of operating systems?

  • A hardware component that executes instructions.
  • A static set of program instructions stored on disk.
  • A virtual representation of the file system.
  • An instance of a running application. (correct)

Why is it important for processes to be protected from each other in a multiprogramming environment?

  • To allow processes to directly modify each other's code.
  • To reduce memory usage.
  • To improve processor speed.
  • To prevent interference and maintain system stability. (correct)

Which of the following elements is NOT typically included in a process control block (PCB)?

<p>Processor's manufacturing date. (C)</p> Signup and view all the answers

What is the role of the dispatcher in process execution?

<p>To switch the processor between different processes. (C)</p> Signup and view all the answers

In the two-state process model, what are the two possible states a process can be in?

<p>Running and Not-Running. (D)</p> Signup and view all the answers

Which of the following events would NOT typically trigger the creation of a new process?

<p>A process entering the blocked state. (A)</p> Signup and view all the answers

Under what circumstances might an operating system terminate a process?

<p>When the process exceeds its allocated time limit. (B)</p> Signup and view all the answers

What is the main purpose of process suspension?

<p>To remove inactive processes from main memory and to reduce memory pressure. (C)</p> Signup and view all the answers

In a five-state process model, what is the key difference between the 'Ready' and 'Blocked' states?

<p>Processes in the 'Ready' state are waiting for CPU time, while processes in the 'Blocked' state are waiting for an event. (C)</p> Signup and view all the answers

Which of the following actions occurs during a mode switch (as opposed to a process switch)?

<p>Switching from user mode to kernel mode. (D)</p> Signup and view all the answers

Which action does NOT typically occur when an operating system performs a process switch?

<p>Deallocating resources for the current process. (D)</p> Signup and view all the answers

In an operating system, what mechanism enables a user process to request services from the kernel?

<p>System call. (D)</p> Signup and view all the answers

What is the primary difference between a trap and an interrupt?

<p>Traps are caused by errors within running programs, while interrupts are triggered by external events. (B)</p> Signup and view all the answers

Which is an advantage of multithreading a process?

<p>Faster context switching between execution contexts within the same process. (D)</p> Signup and view all the answers

In a multithreaded environment, what is the unit of resource ownership?

<p>Process. (B)</p> Signup and view all the answers

What does it mean for an operating system to support multithreading?

<p>The OS can manage multiple threads of execution within a single process. (B)</p> Signup and view all the answers

In an environment using user-level threads (ULTs), who manages the threads?

<p>The thread library within the application. (B)</p> Signup and view all the answers

What is a significant drawback of using user-level threads (ULTs) compared to kernel-level threads (KLTs)?

<p>ULTs cannot take advantage of multiprocessing. (C)</p> Signup and view all the answers

Flashcards

OS Application Execution

Executes applications and provides resources to multiple applications, switching the processor efficiently.

Process Element: Data

A set of data associated with the program code.

What is a Process?

A program in execution; an instance of a running program.

Elements of a process

Identifier, state, priority, program counter, memory pointers, context data, I/O status, accounting information.

Signup and view all the flashcards

Process Control Block (PCB)

A data structure used by the OS to manage processes, containing process elements.

Signup and view all the flashcards

Most basic process states

Running, Ready, Blocked.

Signup and view all the flashcards

Process Trace

Sequence of instructions executed by a single process.

Signup and view all the flashcards

Dispatcher

A small program which switches processor from one process to another

Signup and view all the flashcards

New process

The OS creates a PCB for it and places it in the 'Not Running' state.

Signup and view all the flashcards

Reasons for Process Termination

Normal completion, time limit exceeded, memory unavailable, bounds/protection/arithmetic error, time overrun, I/O failure, invalid/privileged instruction, data misuse, operator intervention, parent termination.

Signup and view all the flashcards

Reasons for Process Suspension

Swapping, other OS reasons, Interactive user request, Timing, Parent process request.

Signup and view all the flashcards

Suspended Processes

Processes often await I/O. Expand memory to fit more processes. Swapping involves moving part/all of a process from memory to disk.

Signup and view all the flashcards

Characteristics of a Suspended Process

The process is not immediately available for execution, may or may not be waiting, and may not be removed until an agent explicitly orders the removal.

Signup and view all the flashcards

Types of OS Control Tables

Memory, I/O, file, and process.

Signup and view all the flashcards

Process Identification

Each application is assigned a unique numeric identifier.

Signup and view all the flashcards

Elements of a Process Image

User program (instructions), user data (modifiable space), stack (parameters), attributes (PCB).

Signup and view all the flashcards

Processor State Information

User-visible registers, control and status, and stack pointers.

Signup and view all the flashcards

What are the Modes of Execution?

Two modes of execution: System and User.

Signup and view all the flashcards

Process Creation by OS

The OS assigns a unique ID, allocates space, initializes the PCB, sets linkages, and expands data structures.

Signup and view all the flashcards

Causes and Types of Interrupt

External, associated to executing, explicit request.

Signup and view all the flashcards

Study Notes

  • These notes cover process description and control in operating systems.

Computer Platform and Hardware Resources

  • Computer platform: hardware components that make up a computer system.
  • Hardware resources:
    • Processors (CPU): execute instructions.
    • Main Memory (RAM): temporary storage for frequently accessed data and instructions.
    • I/O Modules: handle input and output operations.
    • Timers: manage time-related tasks like scheduling.
    • Disk drivers: provide long-term storage for data and programs.

Computer Applications

  • Applications: programs that perform specific tasks by accepting input, processing it, and generating output.
  • Writing applications directly for hardware is inefficient because:
    • Many apps need access to the same hardware, instead, shared routines are are better
    • The CPU can't efficiently manage multiple apps running at the same time
    • Software (OS) is needed to manage how the CPU switches between applications and shared resources.
    • Applications must be isolated from each other to prevent interference.
    • Ex: one application should not be able to access another's data or misused shared.
  • OS provides abstracted/uniform representations of resources that applications can use.

Role of the OS

  • Layer of software between hardware and applications.
  • Abstraction of Resources: OS provides abstracts representations of hardware resources.
    • Applications use a file system provided by the OS instead of directly accessing a disk.
    • Apps request memory from the OS.
  • Resource Management:
    • Resource sharing: enables multiple apps to use resources (CPU, memory).
    • Resource protection: ensures that one app use of resource cannot disrupt another app's use of resources.

Application Execution Management by the OS

  • The OS must ensures that applications run in an orderly and efficient manner
  • Resources are allocated as needed, such as CPU time, memory, and I/O devices.
  • Processor Switching:
    • Shared CPU, multiple applications appear to run simultaneously, even on single-core CPUs.
  • Efficient Resource Utilization:
    • OS ensures the CPU and I/O devices are used effectively, minimizing idle time and maximizing throughput.
  • Process Model: execution of an application corresponds to one or more processes.
    • Process: running application w/ program code, state of execution & allocated resources.
    • OS creates, manages processes, shares/protects resources, maintains system performance.
  • Processes allow the OS to:
    • Concurrently run multiple applications.
    • Quickly switch between applications, creating an illusion of parallel execution.
    • Prevent applications from interfering with each other.
    • Manage resources efficiently.

Process Elements

  • Two fundamental elements of a process are:
    • Program code.
    • Associated data.
  • Code sharing: multiple processes can share code.
    • Ex: two users executing the same program instance
  • Process definition: program in execution including:
    • Sequence of instructions, current state, and system resources.
    • Includes program code and associated data.
  • Only one process can have the RUNNING state at a single point in time.
  • Two processes can share the same program code.

Process-Defining Elements

  • During execution, processes are uniquely identified by elements including:
    • Identifier: Unique ID to distinguish from all other processes.
    • State: Running, waiting for I/O.
    • Priority: Relative level compared to other processes.
    • Program counter: Address of the next instruction to be executed.
    • Memory pointers: Pointers to program code, process data, shared memory blocks.
    • Context data: Data in registers for the processor at any of the process instance points.
    • I/O status information: Outstanding I/O requests, devices assigned, etc..
    • Accounting information: Processor time usage, limits, account numbers, etc.

Process Control Block (PCB)

  • Data structure OS uses to manage processes, also called "task struct" in Linux.
  • PCB contains info about the process, interruptions and resumptions of processes.
  • OS can interrupt/resume processes efficiently, enabling multitasking.
  • When an application is interrupted its current state is saved in the PCB.
  • Key enabling tool for supporting multiple processes and multiprocessing.
  • Process interruption: program counter and processor registers are saved.
  • Process states:
    • Running: the process is being executed.
    • Ready: prepared to run (waiting for the CPU).
    • Blocked: waiting for an event.
  • Importance of PCBs:
    • Enables the OS to efficiently manage processes.
    • Enable process interruption and resumption needed for multiprocessing

Process and Processor Behaviors

  • Trace: sequence of instructions executed by a single process
  • Processor behavior illustration: interleaved traces of multiple processes.
  • E.g. 3 processes with dispatcher program, each having their own traces to executes: -A that runs for 6 instructions, a timeout occurs, -The dispatcher switches to process B, which needs I/O. -So, dispatcher switches to process C. -This cycle continues, and the dispatcher roles change

Process Execution

  • Process: program code and associated data, managed by a PCB.
  • Single-processor system: only one process executes at once.
  • Traces: record of sequence of instructions executed by a process & the processor switches.

Two-State Process Model

  • Simplest for describing process behavior:
    • Running: being executed by the processor.
    • Not Running: waiting to be executed.
  • When created, the OS places processes in the "Not Running" state.
  • When the current process is interrupted, it returns to the "Not Running" state.

Queuing Diagram

  • Depicts the two-state model:
    • "Not Running" processes are placed in a queue awaiting execution.
    • The dispatcher selects a process from the queue, then executes it.
  • Could have FIFO or priority queue.

Reasons for Process Creation

  • OS creates a new process at:
    • New batch job submission.
    • A user interactive terminal log-in.
    • By OS to provide process on behalf of a user program e.g., printing.
    • Spawning an existing process for modularity/parallelism.
  • Parent/child Processes: creating process is parent, created process is child
  • Processes communicate and cooperate often.

Process Termination

  • Means for a process to signal completion.
  • Termination signaled by HALT instruction or OS service calls.
  • Interactive applications signal via user actions (e.g., quitting).

Reasons for Process Termination

  • Normal conditions: process issues OS call for completion.
  • Runtime error: exceeding time limit.
  • Memory unavailable: Memory requirements exceed system's capacity.
  • Bounds violation: Unauthorized memory access.
  • Protection error: Attempt to access unauthorized resource.
  • Arithmetic error: Attempt to execute division by zero
  • I/O failure: Input or output error.
  • Privileged Instruction: Use instruction reserved for the OS.
  • Bad Data/Non assigned or initialized data.
  • Operator/OS Action: terminates process.
  • Termination Parent also results in termination of its children.

Five-State Process Model

  • Refinement of the two-state model by splitting the "Not Running" state into "Ready" and "Blocked" states.

  • The 5 states:

    • Running: being executed.
    • Ready: prepared to execute when given the opportunity.
    • Blocked/Waiting: cannot execute until an event occurs, like I/O completion.
    • New: just created, not yet admitted to the pool of executable processes.
    • Exit: Released, but not immediately deleted.
  • OS manages process using a list of states:

    • processes are created in the new state eventually to ready
    • processes in the ready states are selected for execution
    • When an I/O operation process transitons to the block state
    • When the event occurs, the process transition to the ready state and is awaiting its next turn
    • When a process terminated it transitions to the exit state
  • Dispatcher switches the processor from one process to another

Process States Visual

  • New Process: transitioning from executable to the exit state.
  • The process states during the trace are interleaved.

Using Two Queues

  • The five states can be represented using a queueing diagram.
  • Ready Queue:
    • Ready processes waiting for execution.
  • Blocked Queues:
    • Linked event, e.g., I/O device operation
    • running to either the ready or blacked queues from interrupts.
  • The dispatcher then process from ready.
  • OS manages processes queues depending on the processes - Ready queue is all processes ready for the the CPU & the OS picks processes from the ready queue - /IO Queues are used for processes requiring that type of instruction - When the operation is compelete the process in moved back into the ready queue
  • When a process is terminated it transition to the Exit phase

Suspension

  • The OS needs to be able to remove processes to other devices to limit memory usage
  • moving memory to secondary storage/ the disk or other administrative reason.
  • Suspension: the process is moved to inactive storage - Swapping the process for other to a hard
  • OS manages suspensions as needed when all processes are locked etc.
    • Suspensions can be suspended from the ready state or the blocked state

7 state process model

  • Includes both lock and suspensions creating 7 states total: - blocked/ suspended : Both locked and inactive - Ready/suspending: Ready to run once active
  • Process State Transitions
    • Processes move to suspended states, or are activated back to the running stages

Benefits of Suspension

  • Reduces memory pressure, managing memory and giving process control
  • The states of a suspension is:
    • Can not execute immediate
    • Must be enabled by an agent
    • May or may not be waiting on an event - suspend independent of block events do not mean that processes will transition

Reasons of a Suspension

  • Need to bring them from a ready state to execute state
  • Background processes may be suspended in the event of a problem.
  • Timing of intervals
  • Parent might spend a execution of descendant to examine.

OS Actions

  • OS controls computers schedules processes
  • OS schedules and dispatches process
  • OS allocates the OS processes
  • OS responds to basics that the OS does.
  • OS manages them using the memory (Processes): running process, partly I/O, process swapping

OS Control Tables

  • Memory tables: the allocation of memory. I/O Tables:
  • Manage I/O devices and channel
  • Track device and system I/O devices. File Tables:
    • Store File Tables, and disk locations.
  • Process TAble cont:
    • Information and data tracking
  • Processors must have tracking ability.

Components of a Process Image location or attributes of the state or ID:

  • The location: where a file image is loaded
    • Location: Where the Process image will be loaded
  • attributes, such as current ID and Current State.
  • OS needs to know
  • Image in to the systems: -Program to execute -Variable for use -How called Process can know and use all
  • Unique Proccess IDs.
  • IDs for children process
  • ID for owner is the process is assigned

Processor State

  • The processor State is stored in the PCB
  • The States show: -Usable registers -What is being controlled.
    • Where the PC is being pointed in direction

Process Control Structure(information)

  • Information:

    • Uniquely identified process, process and user ID

    -Scheduling

  • Data Structuring

    • memory managment -Resources Allocated

Process images in Virtual Memory

  • Process is a collection of code in PCB
  • Code is in a private address or is being loaded

Linked lists

  • OS uses a list that uses process tables to reflect new parent or children.
  • Ready Queue: is processes that aren't waiting an event.
  • Wait Queues:
    • Queues waiting for a specific reason
    • These are useful for hierarchially structures
  • Process Comtrol has several things All info to track the structure needed Access can be an easy access to the memory

Modes of Execution

  • user mode: less-priv mode -programs are executed here

  • System: More privileged mode, can have control of things: -can restrict and control registers.

  • -kernel contains the system instructions

  • can allow access and changes from key OS table and user.

  • User mode does not have control , and this prevents unprivileged functions.

  • The bit allows processors to track operations and user calls trigger kernels.

Functions from table in create process in OS is to -

assign it -Assign process and space. -Set a link Set appropriate links. The create a data structured account.

Mechanism of Switching

  • Process a, when OS has an event under control:
  • an interrupt, error trap or an exit.
  • OS can use any reason as mentioned to switch as is relevant to event
  • System functions run an interrupt and handle the error depending. If no: action depend on state and the cause

-A clock slice: is a process reaches interruption time. -The operation system can return to read the state . If not: its returned its slice time Switch process to be in a process code

  • The OS uses the process to move the process

The process operations

OS tasks with each switch.

  • When an operation is to fetch and switch. Is no then return. If the interrupt and the counter jump The mode change must be hardware changed to trigger the change to what level can change the code.

State vs Processes

  • Switching to kernel. This action isn't a process activity
  • Mode switching:

Steps to save switches

  • Set the stack to process.
  • Check it.
  • Move the process

Process and switch flow

Switch operation causes a move, the image helps select another task -A process and context help do the OS as its has all access to process.

Process Switch

  • Fundamental concept of the modern OS
  • The key ability of the OS to manage the process information
  • Contains important states. Ready, running and running.

Process and Thread Characteristics

  • Process: address space, the process
  • Thread: execution path interleaved through programs and processes
    • has an ID its for scheduling

Thread

  • Unit also light
  • Multithreading is the threads.

Sing Thread

  • Has on operation.
  • MDS Dos. Is a operation system simple user usage

Mullti Thread: Allows use and change

-Multithread include the user

Advantages Threads

  • The creation is easy, to allow creation of threads. -faster -It's efficient communication This allows division execution operations which help the threads and prevent corruption

Threads and Uses

  • Multithread single side -Background for the processing is async Structure and speeds is modular structure -When suspension happen

Threads and Base:

  • That maintains executions maintained Thread suspend and terminate

  • The state is: ready. Running and Blocked Is not really suspension is just in locked

  • Operation Spaw-Block Finish RPC

  • RPC is related to one thread If blocked, it causes another block

Multi-Thread server for processing is fast. Also good fro multicore execution as well.

Threads Synchronization

Is a single address Any change and or alteration can case it across others across the server. Child read files at the same rate

Types of Threads

  • Types include user level threads or level User level thread Kernel is not in existence.

Disadvantages

  • Systems have issues. They are not in sync as code changes That is why process have a threads.

System operations of modes of threads

  • One to and one to the other
  • Code with a many and many. Which can get the best outcome

Mutli Core

Good performance depending to run single side operation. That OS can handle.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

Use Quizgecko on...
Browser
Browser