211 - Operating Systems Flashcards

1
Q

What are the functions of a operating system?

A
  • It is an interface between User and Hardware
  • Allocates resources to each user to ensure everyone has a fair share
  • Managed the memory and security etc
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the purpose of an OS

A
  • Convenience

- Efficiency

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

Processes have 1 or more thread….

A

Small sequences of instructions managed independently by schedular

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

Benefit of threads

A

Fast and efficient

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

What is concurrency?

A

The act of managing and running multiple computations at the same time

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

What happens if a thread goes first and another one goes last?

A

It should have the same outcome

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

An interface in Java and how to implement it

A

Runnable and must have “public void run() as it’s method signature to implement it

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

What are the 3 central concepts in concurrent programming?

A
  1. Processor (ingredients)
  2. Program (recipe)
  3. Process (food you make)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which is correct?

A program can have multiple processes

Or

A process can have multiple programs

A

A program can have multiple processes such as clicking on google chrome 10 times and getting 10 different windows

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

What is context switching?

A

Swapping from one process to the other quickly

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

Which is correct?

Processes are always parallel but not always concurrent

Or

Processes are always concurrent but not always parallel

A

Processes are always concurrent but not always parallel

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

What is parallelism?

A

The act of running multiple computations simultaneously

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

Weakness of a schedular

A

It is always adversarial so you expect it to do the worst possible thing

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

Benefits of multiprocessor systems

A
  1. Increased throughput
  2. Economy of scale
  3. Increased reliability
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

When is concurrency safe to do?

A

When not sharing data and when handling read only data

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

What is Moore’s law and what’s wrong with it today?

A

It no longer applies because the transistors get so small that electrons are able to jump over each other due to the lack of space which causes data to be entered in wrong.

Also generates a lot of heat which can cause the hardware to overheat and it’s difficult and expensive to ensure systems don’t overheat

17
Q

What is Amdahl’s law?

A

Speed up is limited by the serial part of the program

18
Q

What is synchronisation?

A

A mechanism to ensure multiple concurrent processes or threads do not simultaneously execute some particular program segment

19
Q

What is competition?

A

Competing for a variable that processes want to reach simultaneously

20
Q

What is the difference between deterministic and indeterminate?

A

Deterministic is same output each time and indeterminate is different output each time

21
Q

What does cooperation do?

A

It manages the offset or time to ensure threads travel across system resources correctly

22
Q

What is a critical section?

A

It is a code section that access a shared resource

23
Q

What is mutual exclusion?

A

Only one thread can run within the critical section at any given time

24
Q

What is a race condition?

A

An error that occurrs due to multiple processes ‘racing’ in an uncontrolled manner through a section of non-atomic code

25
Q

What is a semaphore?

A

It’s either a closed or open condition. When closed, there is no entry, when open there is entry like red and green traffic lights

26
Q

What operations does a semaphore support?

A

Wait() and signal()

27
Q

What does a schedular do?

A

It maintains the queue or processes.

28
Q

What are zombie processes?

A

Threads that are stuck in memory waiting forever to be run. So we must use (public synchronised void) to ensure it doesn’t happen

29
Q

What do you have to consider when using Notify() and NotifyAll()?

A

If you do NotifyAll() you must use while loops as while loops check the condition over and over and for Notify() you can use the if statement as it checks the condition only once.

30
Q

How do you turn a semaphore into a lock?

A

They are a common type of exclusion lock, by giving it a binary value, it acts like a lock.

31
Q

What is polymorphism?

A

An instance of a class which inherits from (extends) another can also be treated like an instance of that class