Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit


April 2021

5004CEM

Operating Systems and Security


1

a)

You are watching a video, playing online chess and word processing, and you suddenly discover that your operating system has stopped working.  Describe three functions that the operating system no longer supplies and the impact of these being missing on what you are doing.

(9 Marks)


b)


i) Given the file directory structure below.  If you are in the Nao subdirectory where there is a file called computer_list.txt, what Linux command would you use to move the computer_list.txt to the Computer subdirectory.

(3 Marks)


ii) How many pipes and processes are used as a result of the following Linux command?  What does the command do?

cat operatingSystem.txt | grep "Linux" | tee OS2.txt | wc -l

(5 Marks)

c)

What Linux command is used to set file permissions?

(2 Marks)

With regards the file permissions read, write and execute, give an example of how each of these file permissions are used.

(6 Marks)


2.

a)

Your colleague has invented a new scheduling algorithm and is seeking your advice on it. The scheduling algorithm uses two queues: queue one is for interactive processes and queue two is for batch processes.  When an interactive process enters the system, the operating system allocates it to the end of queue one. When a batch process enters the system or an interactive process is on queue one longer than 10ms, it is transferred to the start of queue two.  The operating system will randomly choose between queue one and queue two when scheduling processes.

i) Does this algorithm give higher priority to any processes?

ii) Is it likely that any processes will suffer starvation?

iii) Discuss whether this algorithm is fair to all processes.

(3 Marks)

(3 Marks)

(3 Marks)

b)


Given the following processes and burst times.

Process Number

Burst time

P1

11

P2

4

P3

5

P4

7

P5

8

*

Calculate the average waiting time and average turnaround time for the Shortest-Job-First Scheduling approach and the Round-Robin approach with a quantum of 4.

(8 Marks)

c)


Describe how a non-preemptive scheduling algorithm differs from a preemptive scheduling algorithm.

(4 Marks)

Which one is likely to have the greatest overhead, and which is most likely to suffer starvation?

(4 Marks)



3.

a)

i) Describe what the assembly code below does.  You should say what the output is and how this output is achieved. Outline how the interrupt (int 80h) works in assembly code.

section .bss

num resb 1

section .text

global _start

_start

mov ecx,9

mov eax, '1'

mov [num], eax

call print

looping:

mov eax, [num]

sub eax,'0'

inc eax

add eax,'0'

mov [num],eax

call print

mov eax, [num]

sub eax,'0'

cmp eax,9

jne looping

call quit

print:

mov eax, 4

mov ebx, 1

mov ecx,num

mov edx,1

int 80h

ret

quit:

mov eax,1

mov ebx,0

int 80h

(9 marks)

ii) Why do programmers need to learn assembly code?

(4 marks)

Given two real-world examples where assembly code is used.

(2 Marks)

b)

Draw the five-state process model. Describe what transitions are valid between the five states.

(8 Marks)

Give two events that would cause a process to go from one of the states to another state.

(2 Marks)


4.

a)

What is a page fault?

(2 Marks)

Explain what happens if there is a page fault when there is space in RAM and when there is not space in RAM.

(6 Marks)

b)

A computer has 4-page frame spaces in RAM.

A process makes the following page references

1, 2, 4, 8, 1, 2, 2, 3, 1, 5, 5, 4, 2, 8, 7, 2.

Create the page frame tables for the first-in-first-out replacement approach and least-recently-used replacement approach, and the calculate the number of page faults.  Which approach gives the best performance?


(9 Marks)

c)

Consider a single CPU system supporting two running processes, P1 and P2, with the following multi-programming execution behaviour:

P1: [CPU 8ms; IO 3ms; CPU 8ms; IO 2ms; CPU 8ms]

P2: [CPU 2ms; IO 5ms; CPU 2ms; IO 2ms; CPU 3ms]

i) What is the CPU IO burst cycle?

ii) Calculate the elapsed time for the two processes to run to completion.

(3 Marks)

(5 Marks)

5.

a)

i) Describe how it is possible to use buffer overflow to damage computer systems.

(4 Marks)

What can you do to prevent buffer overflow?

(4 Marks)

ii) Describe the common access control method of access control lists (ACL).

(4 Marks)

Give an example how it is applied in a Linux environment.

(4 Marks)

b)

The close() system call is made from a C-program, outline the steps that occur from the running of this system call to the completion of the closing of the file operation.

(9 Marks)