关键词 > CSSE2310/CSSE7231

CSSE2310/CSSE7231 Computer Systems Principles and Programming

发布时间:2022-06-10

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

CSSE2310/CSSE7231 Computer Systems Principles and Programming

Semester Owo Final Examinations, 2021

QUESTION 1


(11 marks 1 mark each)


(a) Write a shell command to show the names (only) of all files and directories in the        "sample" subdirectory of the user's home directory (which is NOT the current directory)

(b) Write a shell command to copy all .c files in the /tmp directory to the data” subdirectory of the current directory

(c) Write a shell command to make a new subdirectory of the current directory called "breakfast"

(d) Write a shell command to compile and link an executable program called doit that uses pthreads and the maths library from a C file called threadcalc.c. All input and output       files are in the current working directory.

(e) Write a shell command to bring any changes from the subversion repository into the working directory (the current directory).

(f) Write a shell command to show all lines in a file called "colours" (in the current directory) that contain the string of characters "green".

(g) Write a shell command to show all lines in a file called "services" in the /etc directory

that do not contain the string of characters "tcp".

(h) Write a shell command that finds all lines in the file shells” (in the /etc directory)      that contain the string "bin" (without the quotes) but not string "usr" (without the quotes) and appends those lines to a file called foo” in the tmp” subdirectory of the current           directory.

(i) Write a shell command that counts the number of lines in a file called "friends" (in the current directory) that contain the word "Shaheen".

(j) Write a shell command that counts all lines in the file fstab” (in the /etc directory) that contain the string "ext4" (without the quotes) and writes that count value to a file  called ext4.count” in the tmp” subdirectory of the current directory.

(k) Write a shell command that, in the current directory, creates a symbolic link called sh

that points to “/usr/bin/sh

QUESTION 2 (6 marks 1 mark each)

Write C declarations to declare a variable baras ...

(a) An array of five non-negative whole numbers

(b) A pointer to a function which takes two character pointers as parameters and returns an integer

(c) An integer which is potentially modified by multiple threads

(d) A high precision floating point number

(e) An array of three character pointers (strings)

(f) A pointer to a function that is suitable for use as a thread function

QUESTION 3


(4 marks 1 mark for each address)


Consider a system with 4KiB pages and a process with the following page table. All numbers are in base 10.

Page Number

Frame Number

0

-

1

41

2

42

3

-

4

44

5

22

...

40

23

41

24

42

43

43

112

...

16,380

132

16,381

99

For each of the following virtual addresses, what is the corresponding physical address?    Write your answer in base 10. If accessing the virtual address would result in a                     segmentation fault, then write "SEGFAULT". If there is insufficient information in the page table (i.e. the page number is not listed) then write "UNKNOWN".

Virtual Address

Physical Address

8,192

16,380

167,936

25,000

QUESTION 4


(6 marks 1 mark each)


moss.labs.eait.uq.edu.au supports 43-bit physical addresses and 48-bit virtual         addresses and uses a four level page table.  Pages are 4KiB in size. Page table entries are 8 bytes each.

A process uses the following virtual address range (all numbers are in base 10):

1200 MiB starting at address 0

(a) What is the maximum memory space for a process on this system (in GiB)?

(b)How much memory (in KiB) would be needed to store the page table for this process?

(c)If the process doubled its memory usage (to 2400 MiB starting at address 0), how much memory (in KiB) would now be needed to store the page table?

(d)If the original process doubled its memory usage (to 2400MiB total - 1200MiB at address 0, and 1200MiB at the highest possible addresses), how much memory (in KiB) would now   be needed to store the page table?

(e)For the original memory usage (1200MiB starting at address 0), if the system used a two

level page table, how much memory (in KiB) would be needed to store the page table?

(f) For the original memory usage (1200MiB starting at address 0), if the system used a single level page table, how much memory (in MiB) would be needed to store the page table?


(5 marks 1 mark each)

(a)  How many processes are created by the execution of this program (including the initial process)?

(b) What is the maximum number of processes that could be running or runnable at any point?

(c)  If standard output buffers are never flushed until a process exits, how many times will the character “3” be output?

(d) What is the minimum number of lines of text that this program will output when run?

(e) What is the maximum number of lines of text that this program will output when run?

(9 marks)

Consider the following network (assume that all networks are as small as possible):

(a)  Fill in the netmask, broadcast address and CIDR for each of the networks (A to D): (6 marks)

Network

Netmask

Broadcast Address

CIDR

A

B

C

D

(b) Fill in the detail for the whole network shown above (as it would appear to the rest of the internet). (2 marks)

Netmask

Broadcast Address

CIDR

(c)  How many unused addresses are there in network B? (i.e. how many additional machines could be added to that network) (1 mark)

QUESTION 7

Consider a "unix" file system where

&     (&     ( &RPSXW  U \VW  PV3ULQFLSO  V DQG3URJUDPPLQJ

(8 marks)

x    blocks are 16 KiB

x    block pointers are 8 bytes

x    inodes have

o 7 direct pointers

o 3 single indirect pointers

o 3 double indirect pointers

(a) What is the maximum file size on this file system? Express your answer in KiB. (2 marks)

(b) What is the maximum file size that can be stored without using a double indirect

pointer? Express your answer in KiB. (2 marks)

(c)Assuming only the inode is cached in memory, how many blocks must be accessed to

read bytes 200,000 to 220,000 (inclusive) from a file into memory?              (2 marks)

(d)If one of the double indirect pointers was replaced by a triple indirect pointer, what is

now the maximum file size on the system? Express your answer in KiB.       (2 marks)