Week 12 - The Operating System And Useful Data Structures Flashcards

1
Q

A process is stored in a number of different states as it is processed. List all 5 states a process can be stored as:

A
  • New
  • Ready
  • Running
  • Waiting
  • Terminated
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
  1. ) What does PCB stand for?
  2. ) The PCB is a table which stores data relating to a process. Each process has a PCB. What information does the PCB store (3 Answers)
  3. ) Each state has its own list of…
A

1.) Process Control Block

  1. )
    - The current value of the Program Counter (PC)
    - The partition Base/Boundary or Page Table of each process.
    - The Value Of Each CPU register.
  2. Processes.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
  1. Define The “Context Switch”. What states do the programs change from and to.
  2. What occurs in a “Context Switch” (explain in terms of two processes)
A

1.) The process of changing which process is currently running in the CPU. This will change a waiting program from a “Ready State” to the “Running State”.

2.
- Process 1 (in the CPU) will copy its register values from the registers, into its PCB table in whichever state it moves to.

  • Process 2 (in the registers) will copy the values it has stored in its PCB over to the register.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
  1. “Many Processes Can Be In A…. State”
  2. “Only one Process Can Be In A… State”
  3. Which two systems work together to schedule processes?
A
  1. Ready State
  2. Running State
  3. The OS and the CPU.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
  1. What is Non Pre-emptive Scheduling?

2. What is Pre-Emptive Scheduling?

A
  1. The process voluntarily gives up its place in the CPU.

2. The OS decides which process runs next and the CPU decides when to remove a running process.

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

Explain the following Scheduling Methods:

  1. ) First Come First Served.
  2. ) Shortest Job Next
  3. ) Round Robin.
A
  1. ) Programs are executed in The Order They Arrive At The “Ready” state.
  2. ) The OS estimates the run times of each waiting process then runs the shortest one next.
  3. ) Each process is allocated a set period of time in the CPU. After the time has ran out, the next process is loaded regardless of wether the previous process has finished or not.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
  1. ) How Does an Array Work?

2. ) What is the Equation For Calculating The Physical Memory Address Of An Element In An Array?

A

1.) A portion of memory is reserved for the array in memory. This is then split into more sections for each element in the array and is given its own index.

  1. B + (W * (I - LB))
    Whereby:
B = Starting Address Of Array.
W = Width of Each Element (How many bytes each element stores)
I = Array Index of The Element We’re After.
LB = Lower Bound Of The Array Indexes (Normally 0 unless otherwise specified)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the Pros of using Arrays (5 in Total)

A
  • Arrays are fast. They only require one addition and one multiplication to find the address.
  • Access to each element is also fast.
  • You can instantly access any element using an index []
  • All Data is stored in a single block of memory.
  • Each Element also has its own block of memory.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What Are The Cons Of Using An Array? (4 answers)

A
  • Adding an element to the start of the array is resource intensive as it requires shifting the entire content of the array up by one.
  • Once an Array is created, it cannot be adjusted. Creation can be deferred, but the size will still be fixed upon compilation!
  • If More Elements Are Stored In An Array Than It Can Hold, The Program Crashes.
  • Programmers tend to build arrays “Large Enough” to be sure they’ll never go over the arrays capacity. This wastes memory and processing power.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
  1. ) What is Each Individual Item Of data Stored in a Linked List Known As?
  2. ) What Does Each Data Item Use To Navigate The List?
  3. ) What Are The Two Main FIELDS A Linked List Stores For Each Item In The Linked List? What does each one do?
  4. ) What Does the Final Item In A Linked List Point To?
  5. ) Elements At The Back Of The List Are Accessed…
A
  1. ) A Node
  2. ) Pointers.
  3. )
    - Value (stores the value of the object).
    - Name (stores the memory address of the next node in the list).
  4. It doesn’t! It’s value is null!
  5. Slowly. It has to go through the list one by one!
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
  1. ) By which premises Does A Stack Operate?
  2. ) What Must The Stack Keep Track Of? How Does It Track This?

3.) What is the Result Of The Following Pops?
Push 12, Push 4, Push 9, Pop, Push 14, Push 7, Pop, Pop.

A
  1. ) First In, Last Out (FILO)
  2. ) The Top Of The Stack Must Be Tracked. This Is Done Using A Pointer!
  3. ) 9, 7, 14
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
  1. ) By Which Premises Does A Queue Function?
  2. ) What Must The Queue Track To Manage The Queue?
  3. ) What Can A Queue Be Used For? (Two Answers)
A
  1. ) First In First Out (FIFO)
  2. ) The Head And Tail Of The Queue
  3. )
    - Used as a Buffer Between A Process That Produces An Output and A Process That Takes That Output as Input.
  • Used To Keep A Process Flowing. The Process Does Not Need To Stop When Other Processes Cannot Keep Up As One Goes In And One Goes Out.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly