System Software Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

How can the operating system maximise the use of resources in primary memory?

A

-Moving frequently accessed instructions to cache
…for faster recall
… as SRAM is used rather than DRAM for cache.
-Making use of virtual memory
…with paging or segmentation
…to swap memory to and from disk.
-Partition memory
… dividing main memory into static partitions
… to allow more than one task to be available
-Removing unused item/tasks from RAM
… by marking a partition as available
… as soon as the process using it has terminated.

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

How can the operating system maximise the use of resources in the disk?

A

-Disk cache
… a disk cache holds data that is frequently transferred to/from the disk
… the cache can be held in disk or RAM.
-Compression utility
…decreasing the size of file stored on the disk
… in order to fit larger files on the disk
-Defragmentation utility
… files are rearranged to occupy contiguous disk space
… this reduces the time taken to access files/decreases latency.

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

How can the operating system maximise the use of resources in the CPU?

A

-Scheduling
…better utilisation of CPU time and resources.

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

How can the operating system maximise the use of resources in the input item system? (bastante extra)

A

-IO operation initiated by the computer user.
-IO operation which occurs while software is being run and resources such as printers and disk drivers are requested.
- A DMA (Direct memory access) controller is needed to allow hardware to access the main memory independently of the CPU.
-DMA initiates the data transfer
-CPU carries out other tasks while data transfer operation takes place.
-Once the data transfer is complete, an interrupt signal is sent from the DMA to CPU.

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

How can the OS hide the complexity of harware?

A

-Using graphical interface rather than command line interface.
-Using device drivers simplifies the complexity of the hardware interface.
-Simplifying the saving and retrieving of data from memory and storage devices.
-Carrying out background utilities, such as a virus scanner which the user can “leave it to its own device”.

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

Define a program

A

The written code.

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

Define a process

A

A program that has started to be executed (dynamic).

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

What is the PCB (Process control block)

A

A data structure which contains all of the data needed for a process to run; this can be created in memory when data needs to be received during execution time.

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

What does the PCB store? ( 2 marks)

A

-Current process state
-Process privileges
-Register values
-Process priority and any scheduling information.
-The amount of CPU time the process will need to complete.
-A process ID which allows it to be uniquely identified.
-I/O status information.

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

Define multitasking

A

Allow computers to carry out more than one task at a time. Each of these processes will share common hardware resources. To ensure multitasking operates correctly, scheduling is used to decide which process is carried out first.

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

Describe the process state new

A

Process is being created.

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

Describe the process state ready.

A

-The process is not being executed.
-The process is in the queue
… waiting for the processor’s attention/CPU time.

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

Describe the process state blocked

A

-The process is waiting for an event.
-So it can’t be executed by the moment.
-e.g. Input/Output

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

describe the process state running

A

-Process is being executed by the CPU.
-Process is currently using its allocated time slice.

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

descrribe the process state terminated.

A

-Process has finished executing

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

what are the conditions for a state to go from ready to running

A

-Current process is no longer running// processor is available.
-Process was at the head of the queue.

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

what are the conditions for a state to go from blocked to ready

A

-The only required resource become available// resource/event/IO operation is complete.

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

What are the conditions for a state to go from running to ready

A

-When a process is executing it is allocated a time slice.
-When the time slice is completed, the process can no longer use the processor even if it is capable of further processing.

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

What are the conditions for a state to go from running to blocked

A

-Process is executed when it needs to perform IO operation.
-Placed in a blocked state until the IO operation is complete.

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

Explain how the processes are affected when the following events takes place.

-The running process needs to read a file from the disk.

-The running process using up its time slice.

A

1.
-Running process is halted.
-Process moved to a blocked state

2.
-Running process is halted.
-Process moves to ready state
… until the next time slice is allocated.

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

Explain why a process cannot be moved from the blocked state to the running state

A

-When IO operation is completed for the process in a blocked state.
-Process put into the ready queue.
-OS determines which process get next use of the processor from the ready queue.

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

Explain why a process cannot be moved from the ready state to the blocked state.

A

-To be in a blocked state, the process must initiate some IO operation.
-To initiate operation, the process must be executing.
-If the process is in ready state, it cannot be executing; hence must be in running state.

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

What is the purpose of process scheculing.

A

-Process scheduling allows more than one program/task to appear to be executed at the same time / enables multitasking / multiprogramming.
-To allow high priority jobs to be completed first.
-To keep the CPU busy all the time
… to ensure that all processes execute efficiently
… and to have reduced wait times for all processes / to ensure all processes have fair access to the CPU / prevent starvation of some processes.

24
Q

What does a high level-scheduler do?

A

Controls the selection of a program stored on disk to be removed into main memory. It decides which processes are loaded from the backing store into the memory/ready queue.

25
Q

What does a low level scheduler do.

A

-Decides which of the processes in ready state
…should get use of processor/be put in running state
…based on position/priority
… invoked after interrupt/OS call

26
Q

Explain how the scheculing routine shortest job first works.

A

-Processes are executed in ascending order of the amount of CPU time required // Short processes are executed first and followed by longer processes.
…which leads to an increased throughput (because more processes can be executed in a smaller amount of time).

27
Q

Explain how the scheculing routine round robin works.

A

-Each process is served by the CPU for a fixed time/time slice (so all processes are given the same priority).
- Starvation doesn’t occur (because for each round robin cycle, every process is given a fixed time/time slice to execute).

28
Q

Explain how the scheduling routine first come first serve works.

A

-No complex logic, each process request is queued as it is received and executed one by one.
-Starvation doesn’t occur (because every process will eventually get a chance to run) // less processor overhead

29
Q

Explain how the scheduling routine shortest reamining time works.

A

A variation of SJF where the scheduler can preempt the currently running process if a new process with a shorter expected execution time becomes available.

30
Q

How are interrupts handled?

A

-The source of the interrupt is identified.
-The interrupts of low priority are disabled.
-Kernel will consult the IDT (interrupt dispatch table) - links a device description with the proper interrupt routine.
-IDT will supply the address of the low-level routine to handle the interrupt event.
-The kernel will save the contents of the registers on the kernel stack.
-The interrupt service routine is loaded and run.
-Registers are restored
-All interrupts are enabled.
-Continue execution of interrupts.

31
Q

What is paging?

A

-Paging allows the memory to be divided into fixed size blocks
-The operating system divides the memory into pages.
-A program is allocated a number of pages that is usually just larger than what is actually needed.

32
Q

Define the terms page table, page and page frame.

A

Page table
The page map table shows the mapping to pages to page frames.

Page
Virtual memory divided into blocks of fixed size

Page Frame
The main memory is divided into page frames of the same size as page.

33
Q

How is paging used to handle virtual memory?

A

-Divide main memory/RAM into frames.
-Divide virtual memory into blocks of the same size called pages.
-Frame/pages are fixed size.
-Set up a page (map) table that translates logical to physical address.
-Keeps track of all free frames.
-Swap pages in memory with new pages from disk when needed.

34
Q

What is segmentation?

A

-Segmentation divides the memory into variable sized blocks
-The compiler is responsible for calculating the segment size.

35
Q

what is virtual memory?

A

-Disk / secondary storage is used to extend the RAM / memory available
… so the CPU appears to be able to access more memory space than the available RAM _Only the data in use needs to be in main memory so data can be swapped between RAM and virtual memory as necessary.
-Virtual memory is created temporarily.

36
Q

What are advantages of using virtual memory?

A

-Not all pages need to be in memory at one time.
-More than one process can be in ready state
… because memory addresses can be mapped.
-A process can have an address space larger than that of physical memory.

37
Q

What is meant by disk thrashing?

A

-Pages are requested back into RAM as soon as they are moved to the disk.
-There is continuous swapping ( of the same page)
-No useful processing happens (deadlock).
-Pages that are in RAM and disk are interdependent.
-All processing times are used for swapping pages.

38
Q

When does page replacement happen.

A

-Page replacement happens when a new page is requested but it is not in main memory.
-A page fault occurs. SO the OS replaces one of the existing pages with the new page.
-There are different ways to decide which page to replace.

39
Q

Describe the FIFO page replacement algorithm

A

-The OS keeps track of all the pages in memory using a queue structure.
-The oldest page is removed when a new page has to be added.
-FIFO algorithms don’t consider page usage when replacing pages.

40
Q

Explain how least recently used page replacement works.

A

-The page which has not been used for the longest time is replaced.
-To use this it is necessary to maintain a linked list of all pages in memory with the most recently used page at the front and the least recently used page at the rear.

41
Q

Exaplin how least used page replacement works. What are the drawbacks?

A

-Intuitive how this works

-Additional data required: NUmber of times the page has been accessed

-DRawbacks:
- A page just entered has a low least-used value
-… so likely to be a candidate for immediately being swapped out.

42
Q

How does an interpreter work?

A

-An interpreter examines source code one statement at a time.
-Check each statement for errors
…If no error is found the statement is executed
…If an error is found this is reported and the interpreter halts.
- Interpretation is repeated for every iteration in repeated sections of code/in loops -Interpretation has to be repeated every time the program is run

43
Q

Why use an interpreter to debug?

A

-Debugging is faster.
-Can debug incompleted code.
-Better diagnostics

44
Q

What things are removed at the lexical analysis stage of compilation. What might be identified.

A

-White spaces, comments and reduntant characters are removed.
-Erros might be identified.

45
Q

What is a keyword table and what does it contain?

A

A keyword table is generated in the lexical analysis stage. It contains all the tokens for reserved keywords and symbols.

-The reserved keyword used
-The operator used
-Their matching token

46
Q

In the lexical analysis stage a symbo, table is produced what does it store?

A

-Identifier name used.
-The data type
-Role e.g. constant, array, procedure
-Location marker, value of constant

47
Q

What does the compiler do in the syntax analysis stage?

A

-It checks that the code matches the grammar of the language // It checks that the tokens conform with the rules of the programming language.
-Syntax errors are reported.
-A parse tree is produced.

48
Q

Explain how the keyword table and symbol table are used to translate the source code program.

A

-Keywords are looked up in the keyword table.
-They are represented by tokens.
-Identifiers are looked up in the symbol table
-They are converted into location/address
-Used to create a sequence of tokens (for the program).

49
Q

What does the compiler do in the code generation stage.

A

-Produces an object program to perform the task defined in the source code.
-The object program is in machine-readable form(binary):
…Either in machine code that can be directly executed by the CPU
…Or in intermediate code that is converted into machine code when the program is loaded.

50
Q

What is the optimization stage in?

A

-Performing the task using the minimum amount of resources. This includes execution time, storage space, memory and CPU use.

51
Q

Why is code optimized?

A

-Redundant code removed.
-Program requires less memory.
-Code reorganised to make it more efficient.
-Program will complete task in a shorter time.

52
Q

Why is optimization necessary?

A

-Optimisation means the code would have fewer instructions.
-Optimised code occupies less memory in space.
-Fewer instructions reduce the execution time of the program.

53
Q

What are the benefits of code optimisation?

A

-Code has fewer instructions/occupies less memory in space.
-Shortens the execution time for the program // time taken to execute the whole program decreases.

54
Q

Why does a compiled version protect the security of the source code?

A

-Compiler produces executable version - not readable.
-Difficult for reverse engineering.

55
Q

Why can RPN be used to evaluate expressions.

A

-Reverse Polish Notation provides an unambiguous method of representing an expression
… reading from left to right.
…without the need to use brackets
…with no need for rules of precedence / BODMAS

56
Q

Describe the main steps in the evaluation of a PN expression using a stack

A

-Expressions are always evaluated from left to right
-If an element is a number, push that number into the stack.
-If element is an operator, then pop the first two numbers on the stack
… perform those operations on these two numbers.
-PUSH result back into stack
-END once the last item in the expression has been dealt with.