Processes and Interprocess Communication: A Deep Dive into Linux Operating System, Slides of Software Engineering

The concept of processes in the context of operating systems, focusing on Linux. Topics include process states, process scheduling, process representation, and interprocess communication through shared memory and message passing. Understand the role of processes in memory, process control blocks, and the various queues in process scheduling.

Typology: Slides

2019/2020

Uploaded on 11/13/2020

mas-k
mas-k 🇵🇰

3 documents

1 / 58

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Chapter 3: Processes
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a

Partial preview of the text

Download Processes and Interprocess Communication: A Deep Dive into Linux Operating System and more Slides Software Engineering in PDF only on Docsity!

Chapter 3: Processes

Chapter 3: Processes

  • (^) Process Concept
  • (^) Process Scheduling
  • (^) Operations on Processes
  • (^) Interprocess Communication
  • (^) Examples of IPC Systems
  • (^) Communication in Client-Server Systems

Process Concept

  • (^) An operating system executes a variety of programs:
    • (^) Batch system – jobs
    • (^) Time-shared systems – user programs or tasks
  • (^) Textbook uses the terms job and process almost interchangeably
  • (^) Process – a program in execution; process execution must progress in sequential fashion
  • (^) Multiple parts
    • (^) The program code, also called text section
    • (^) Current activity including 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 run time
  • (^) Program is passive entity stored on disk ( executable file ), process is active
    • (^) Program becomes process when executable file loaded into memory
  • (^) Execution of program started via GUI mouse clicks, command line entry of its name, etc
  • (^) One program can be several processes
    • (^) Consider multiple users executing the same program

Process in Memory

Diagram of Process State

Process Control Block (PCB)

Information associated with each process

(also called task control block )

  • (^) Process state – running, waiting, etc
  • (^) Program counter – location of instruction

to next execute

  • (^) CPU registers – contents of all process-

centric 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

Threads

  • (^) So far, process has a single thread of execution
  • (^) Consider having multiple program counters per process
    • (^) Multiple locations can execute at once
      • (^) Multiple threads of control -> threads
  • (^) Must then have storage for thread details, multiple program

counters in PCB

  • (^) See next chapter

Process Representation in Linux

  • (^) Represented by the C structure task_struct pid t_pid; /* process identifier / long state; / state of the process / unsigned int time_slice / scheduling information */ struct task_struct parent; / this process’s parent / struct list_head children; / this process’s children */ struct files_struct files; / list of open files */ struct mm_struct mm; / address space of this process */

Ready Queue And Various I/O Device Queues

Representation of Process Scheduling

 (^) Queueing diagram represents queues, resources, flows

Addition of Medium Term Scheduling

 (^) Medium-term scheduler can be added if degree of multiple programming needs to decrease  (^) Remove process from memory, store on disk, bring back in from disk to continue execution: swapping

Multitasking in Mobile Systems

  • (^) Some systems / early systems allow only one process to run, others

suspended

  • (^) Due to screen real estate, user interface limits iOS provides for a
    • (^) Single foreground process- controlled via user interface
    • (^) Multiple background processes– in memory, running, but not on the display, and with limits
    • (^) Limits include single, short task, receiving notification of events, specific long- running tasks like audio playback
  • (^) Android runs foreground and background, with fewer limits
    • (^) Background process uses a service to perform tasks
    • (^) Service can keep running even if background process is suspended
    • (^) Service has no user interface, small memory use

Operations on Processes

  • (^) System must provide mechanisms for process creation,

termination, and so on as detailed next

Process Creation

  • (^) Parent process create children processes, which, in turn create

other processes, forming a tree of processes

  • (^) Generally, process identified and managed via a process identifier

( pid )

  • (^) Resource sharing options
    • (^) Parent and children share all resources
    • (^) Children share subset of parent’s resources
    • (^) Parent and child share no resources
  • (^) Execution options
    • (^) Parent and children execute concurrently
    • (^) Parent waits until children terminate