OS Chapter 3

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/50

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

51 Terms

1
New cards

proccess

a program in execution

2
New cards

Program counter

specifying the next instruction to execute and a set of associated resources

3
New cards

proccess text section

the executable code

4
New cards

Process - Data Section

global variables

5
New cards

Process - Heap section

memory that is dynamically allocated during run time

6
New cards

Process - Stack Section

temp data storage when invoking functions, parameters and local varables p

7
New cards

Process State - New

the Process is being created

8
New cards

Process State - Running

Instruction of the process are being executed

9
New cards

Process State - Waiting

The process is waitign for some event to occur such as an IO event

10
New cards

Process State - Ready

The process is waiting to be assigned to the CPU (to run)

11
New cards

Process State - Terminated

The process has finished execution or forced to terminate

12
New cards

Process Block Cotrol

a data structure used by the operating system to store information about a process

  • proccess state

  • ID

  • proccess counter

  • cpu register

  • cpu scheduling

13
New cards

Process Scheduling

method by which the operating system determines which process should run at any given time

14
New cards

Process Scheduling Queues

As processes enter the system, they are put into a ready queue. the queue doesnt move, the pointer does SHORT TERM SCHEDULING

15
New cards

Swapping

intermediate form of scheduling used in some operating systems to manage memory. It involves temporarily removing a process from memory and saving its state to disk, and later reintroducing it back into memory when needed.

16
New cards

Long Term Scheduling

(also known as Job Scheduling) is responsible for managing the admission of processes into the system for execution. It decides which processes should be moved from the new queue to the ready queue based on system conditions and resource availability.

17
New cards

Context Switch

  • also known as Process Switching, occurs when the CPU switches from executing one process to another

  • EXAMPLE

    • Interrupt: The CPU is interrupted during Process 0’s execution (hardware/software interrupt).

    • Save State: Process 0’s state is saved in its PCB0 (registers, program counter, memory context).

    • Idle Process: Process 0 is idle and placed in the queue.

    • Load State: The state of Process 1 is loaded from PCB1.

    • Execution: Process 1 is executed.

      • Repeat: After Process 1 finishes, the process repeats for Process 0.

18
New cards

process creation

fork() returns the child PID, can wither share all info, some or none. the child can either be the duplicate of the parent or a new program laded into it. 2 ^n -1 child processes

19
New cards

wait()

the parent waits until the child is done to contiue to execute, with out this the child and parent execute concurently

20
New cards

exec()

used after a fork() to replace the existing proccess and start with a new program

21
New cards

pid > 0

parent processch

22
New cards

pid == 0

child process

23
New cards

proccess creation - windows API

CreateProcess()

24
New cards

orphan process

the parent porcess is abort() when the child is running

25
New cards

zombie process

the parent calls fork() with out using wait() ssytem call

26
New cards

Interprocess Communication(IPC)

mechanisms that allow processes to communicate and share data with each other within an operating system

27
New cards

Independent Process

doesnt share data with any other process

28
New cards

Cooperating process

can affect or be affected by the other processes executing in the system (shares data with other processes).

29
New cards

IPC Shared Memory

typically faster than message passing – initial system call only to established the shared memory segment, afterward it can be accessed in user mode

<p>typically faster than message passing – initial system call only to established the shared memory segment, afterward it can be accessed in user mode</p>
30
New cards

IPC Message Passing

all communication use system call (continuous kernel intervention can slow down the performance) easier to implement, need send()/recive() to implement a link

<p>all communication use system call (continuous kernel intervention can slow down the performance) easier to implement, need send()/recive() to implement a link</p>
31
New cards

IPC in message-passing - Direct Communication Symmetry

processes must name each other explicitly: send (P, message) – Send a message to process P. receive(Q, message) – Receive a message from process Q.This scheme exhibits symmetry in addressing.

32
New cards

IPC in message-passing - Direct Communication Asymmetry

send (P, message) – Send a message to process P. receive(id, message) – Receive a message from any process.

33
New cards

IPC in message-passing - Indirect Communication

Messages are sent to and received mailboxes or ports. send (A, message) – Send a message to mailbox A. receive(A, message) – Receive a message from mailbox A.

34
New cards

IPC in message-passing - Synchronization - Blocking/synch message passing

ensures that processes coordinate effectively when sending and receiving messages. This prevents issues like race conditions, data inconsistencies, or deadlocks.

35
New cards

Blocking send.

The sending process is blocked until the message is received by the receiving process or by the mailbox

36
New cards

Blocking receive.

The receiver blocks until a message is available.

37
New cards

Non blocking

asynchronous, allows a process to send or receive a message without waiting for the other process to be ready. In other words, the sender doesn't pause or wait for the receiver to acknowledge the message

38
New cards

Non-blocking send

the sender sends the message and return before the delivery of the message (will not wait for a confirmation)

39
New cards

Non-blocking receive

the receiver receives a valid message, or a null.

40
New cards

IPC in message-passing - Buffering

Whether communication is direct or indirect, messages exchanged by communicating processes reside in a temporary queue.

41
New cards

IPC in message-passing - Buffering - Zero capacity

no quue existing

42
New cards

IPC in message-passing - Buffering - Bounded Capacity

queu length n If the queue is not full when a new message is sent, the message is placed in the queue, and the sender can continue execution without waiting.

43
New cards

IPC in message-passing - Buffering - Unbounded Capacity

the queue's length is potentially infinite; thus, any number of messages can wait in it. The sender never blocks.

44
New cards

Ordinary Pipes

Unidirectional communication, typically used in a parent-child process relationship for communication within the same machine.

45
New cards

Issues with Pipes

  • Bidirectional or unidirectional communication.

  • Half-duplex or full-duplex communication.

  • Parent-child relationship.

46
New cards

Producer-Consumer Model

The producer writes to the pipe's write end, and the consumer reads from the read end. Pipes are unidirectional, but two pipes can be used for bidirectional communication.

47
New cards

pipe() Function

pipe(int fd[]) creates a pipe with two file descriptors: fd[0] for reading and fd[1] for writing. This is used for communication between a parent and child process.

48
New cards

Reading and Writing with Pipes

  • Parent writes: write(fd[1], dataBuf, count)

  • Child reads: read(fd[0], dataBuf, count)

  • This allows communication between the two processes using the pipe.

49
New cards

Named Pipes (FIFOs)

More powerful than ordinary pipes, allowing bidirectional communication without a parent-child relationship.

50
New cards

Sockets

socket is an endpoint for communication in a network. A pair of processes communicating over a network use a pair of sockets, identified by an IP address and port number.

51
New cards