Lecture 4: Processes 1 Flashcards

1
Q

Role of the OS:

  1. Resource Abstraction
  2. Resource Sharing

Supported in the these ways:

A
  • Process and thread management (resource: CPU)
  • Memory management (resource: Memory)
  • File management (resource: Secondary Storage)
  • I/O system management (resource: Devices)
  • Protection system (resource: All)
  • Command-interpreter system (resource: All)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Shell (or Command-Line-Interpreter)

A
  • A shell is a job control system which allows the programmer to create and manage a set of programs to do some task.
  • it is a program that reads and interprets control statements.
  • The “visible face” of an OS (sometimes with GUI (e.g.: Windows)
® Process creation and management
® I/O handling
® Secondary storage management
® Main memory management
® File system access
® Protection
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Control Statements of the Shell

A

User-driven commands to the OS (vs. event-driven commands such as interrupts)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Process

A

-program in execution

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How Is a Process an Abstraction of the CPU?

A
  • Gives an illusion of a uniprogramming environment

- Every process acts as though it has exclusive access to the CPU

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

In Reality: Multiprogramming

A
  1. CPU is time-sliced:
    processes take turns using the CPU
  2. Memory is space-sliced:
    processes get partitions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Threads

A
  • Lightweight process (no isolation)
  • Abstraction only of CPU
  • One process can have many threads (multithreading), all share the same memory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Difference between threads and processes

A
  1. Threads: mostly cooperative. Processes: mostly independent –a thread communication is inexpensive (via shared memory)
    - a e.g., a user can type characters and have the speller running
  2. Threads more appropriate for certain applications
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What makes up a process?

A
  • Code section (text segment)
  • Data section (data segment)
  • Stack (stack segment)
  • Registers (including Program Counter)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Program vs Process

A
  • Program is a passive entity
  • an executable stored in disk

Process is a dynamic entity
-a program becomes a process when it is loaded into memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Process Control Block (PCB)

A

Processes Represented In Memory with Current “State”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Context Switch

A
  • process with access to CPU switched out (state copied to PCB)
  • another ready process switched in (state copied from PCB)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Process Scheduling: Multiprogramming Goal

A
  • maximize CPU utilization

- have some process running (using the CPU) all time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Process Scheduling: Time –sharing Goal

A
  • users can interact with their running programs

- switch CPU among processes frequently enough

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Process Scheduler

A

it selects the

process for program execution on the CPU

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Job Queue

A

Contains all processes in system

17
Q

Ready Queue

A

It includes processes that are residing in main memory and are ready to execute

18
Q

Device Queues (Waiting) Queue Headers

A

It includes processes waiting for an I/O device

19
Q

Schedulers

A

-Select which processes to allocate to CPU
-Submitted processes can be spooled into disk for
later execution

20
Q

Short term scheduler

A
  • selects one from memory and allocate the CPU to it
  • Selects processes from the ready queue
  • Will be invoked frequently (every few milliseconds) Þ needs to be fast!!
21
Q

Long term scheduler

A

-moves processes from disk to main memory

  • Selects which processes should be brought into ready queue
  • Controls degree of multiprogramming (# processes in memory)
  • Invoked infrequently (e.g.: seconds or minutes), \ can be slow
  • Needs to make a careful process mix between I/O vs CPU bound processes
22
Q

CPU Bound

A

spends more time doing computations

23
Q

I/O Bound

A

spends more time doing I/O

24
Q

I/O heavy mix

A

the ready queue will always be empty (no process is ready to use the CPU as they are in the device queue )

25
Q

CPU heavy mix

A

CPU contention, devices are unused and system is unbalanced

26
Q

Medium-Term Scheduler

A
  • Can reduce the degree of multiprogramming by removing processes from memory (swapping) -> reduce CPU contention
  • Can be used to improve the process mix or fix overcommitted memory requirements
27
Q

Process and Memory

A
  • process also serves as an abstraction of memory
  • Process has exclusive access to all memory that it can address
  • Process has exclusive access to all memory it can reference
  • Memory is partitioned amongst processes
  • Memory consists of non-contiguous chunks
28
Q

Process and Memory Exclusivity

A

-all processes assigned a base register and limit register defining its address space (e.g.: 10,000 – 12,000 has base register = 10,000 and limit register = 2,000)

  • base, limit registers are like status registers (process can’t touch )
  • all addressing translated accordingly
29
Q

Virtual Memory

A

®
- (P’s addr space) can be larger than physical memory process P
Solution is “Virtual memory”
Idea: Some of process’ address space not in memory but on disk
-transparent to process (will see again later in course)

30
Q

Memory Mapped I/O

A

-Reserve addresses in address space to refer to device controller registers (e.g.: video controller, or disk)

-+ I/O registers are part of the regular memory address space.
+ uses the same address bus to address both memory and I/O devices
+ CPU instructions used to access the memory are also used for accessing
devices

31
Q

Segmentation

A

Store process’ address space as non-contiguous set of “contiguous chunks”