Operating System Chapter 3: Processes
5 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the physical implementation of a communication link?

  • Only shared memory
  • Only hardware bus
  • Only network
  • Shared memory or hardware bus or network (correct)
  • In direct communication, how do processes communicate with each other?

  • Through a hardware bus
  • By naming each other explicitly (correct)
  • Through a network
  • Through a common mailbox
  • What is the property of a link in direct communication?

  • A link may be unidirectional or bi-directional
  • A link is associated with exactly one pair of communicating processes (correct)
  • A link may be associated with many processes
  • A link is established only if processes share a common mailbox
  • What is the operation to create a new mailbox in indirect communication?

    <p>create a new mailbox</p> Signup and view all the answers

    In indirect communication, what is the primitive to receive a message from mailbox A?

    <p>receive(A, message)</p> Signup and view all the answers

    Study Notes

    Process Concept

    • A process is a program in execution, which forms the basis of all computation
    • A process consists of:
      • Program code (text section)
      • Current activity (program counter, processor registers)
      • Stack containing temporary data (function parameters, return addresses, local variables)
      • Data section containing global variables
      • Heap containing memory dynamically allocated during runtime

    Process State

    • A process can be in one of the following states:
      • New: The process is being created
      • Running: Instructions are being executed
      • Waiting: The process is waiting for some event to occur
      • Ready: The process is waiting to be assigned to a processor
      • Terminated: The process has finished execution

    Process Control Block (PCB)

    • A PCB is a data structure that contains information associated with each process
    • PCB contains:
      • Process state
      • Program counter
      • CPU registers
      • CPU scheduling information (priorities, scheduling queue pointers)
      • Memory-management information (memory allocated to the process)
      • Accounting information (CPU used, clock time elapsed since start, time limits)
      • I/O status information (I/O devices allocated to process, list of open files)

    Process Representation in Linux

    • In Linux, a process is represented by a task_struct data structure
    • The task_struct contains information such as:
      • Process ID (pid)
      • State (long state)
      • Time slice (unsigned int time_slice)
      • Parent process (struct task_struct *parent)
      • List of children (struct list_head children)
      • Files (struct files_struct *files)
      • Memory management (struct mm_struct *mm)

    Process Scheduling

    • The process scheduler selects among available processes for next execution on CPU
    • The scheduler maintains scheduling queues of processes:
      • Job queue: Set of all processes in the system
      • Ready queue: Set of all processes residing in main memory, ready and waiting to execute
      • Device queues: Set of processes waiting for an I/O device

    Schedulers

    • Short-term scheduler (or CPU scheduler): Selects which process should be executed next and allocates CPU
    • Long-term scheduler (or job scheduler): Selects which processes should be brought into the ready queue

    Interprocess Communication (IPC)

    • Cooperating processes need IPC to share data and affect each other
    • Two models of IPC:
      • Shared memory
      • Message passing

    Message Passing

    • Implementation of communication link:
      • Physical: Shared memory, hardware bus, network
      • Logical: Direct or indirect, synchronous or asynchronous, automatic or explicit buffering

    Direct Communication

    • Processes must name each other explicitly:
      • Send (P, message) – send a message to process P
      • Receive (Q, message) – receive a message from process Q

    Indirect Communication

    • Messages are directed and received from mailboxes (also referred to as ports)
    • Each mailbox has a unique id
    • Processes can communicate only if they share a mailbox
    • Operations:
      • Create a new mailbox (port)
      • Send and receive messages through mailbox
      • Destroy a mailbox

    Studying That Suits You

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

    Quiz Team

    Description

    This quiz covers the concepts of processes in operating systems, including process scheduling, operations on processes, interprocess communication, and communication in client-server systems.

    More Like This

    Use Quizgecko on...
    Browser
    Browser