Final Exam - Practice Questions Flashcards

Prep for Final

1
Q

How do you map a virtual address to a physical one?

A
  1. Use integer division to find the page.

Page = Virtual Address / Page Size

  1. Calculate the offset offset= virtual address % page size
  2. Find the frame by mapping the page to a frame via the page table
  3. physical address=frame∗(page size)+offset
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How many table accesses are required to access the following virtual addresses in a 2 level table?

Virtual Address Page

50000 50

50001 50

55020 53

44000 40

A

If you don’t have the pages for each virtual addresses. Get the page that they are associated with.

Page = Virtual Address / Page Size

Address: 50000. Accessing the L1 page first (+1). Then go to the L2 Page and then go to the page that contains the physical address (+1). From here access the frame containing our physical address (+1). The page to frame is now stored in the TLB.

  • (Running Total: 3)

Address: 50001. We already accessed this page before and it’s stored in the TLB. So access it (+1).

  • Running Total: 4

Address 55020 isn’t stored in the TLB. So we go to L1 (+1). Then go to the L2 Page and then go to the page that contains the physical address (+1). From here access the frame containing our physical address (+1)

  • Running Total: 7

Address 44000 isn’t stored in the TLB. So we go to L1 (+1). Then go to the L2 Page and then go to the page that contains the physical address (+1). From here access the frame containing our physical address (+1)

-Total : 10

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

How many immediate subdirectories does this directory have?

241772 drwx—— 5 uqjfenw1 uusers 56 Sep 16 12:14 ass3

A

241772 drwx—— 5 uqjfenw1 uusers 56 Sep 16 12:14 ass3

  1. The 3rd column minus 2. The parent directory and this directory itself.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What would happen if filea is changed to filec?

241772 drwx—— 5 uqjfenw1 uusers 56 Sep 16 12:14 ass3

202110918 -rw——- 1 uqjfenw1 uusers 26871 Sep 16 12:14 ass3_spec.tex

202110926 -rw——- 2 uqjfenw1 uusers 1621 Sep 17 10:38 filea

202110926 -rw——- 2 uqjfenw1 uusers 1621 Sep 17 10:38 fileb

202110913 -rwx—— 1 uqjfenw1 uusers 18042 Sep 16 11:57 grum.py 202110914 -rwx—— 1 uqjfenw1 uusers 117616 Sep 16 11:59 ls

202110950 ———- 1 uqjfenw1 uusers 801 Sep 16 12:25 smoketest

A

Nothing. Hard links point to the memory location, not the file. So changing the file name doesn’t change its contents.

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

The current directory contains a program called grum.py. What command should I use to ensure that I can run grum.py in any directory on the system just by typing grum.py?

A

Need to export it to the path.

Export PATH = $PATH:home/grum.py

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

Which command(s) would I need to run in order to allow all users to execute a binary file called smoketest?

A

chmod a+x smoketest

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

Which layer(s) of the network stack are affected by the following changes:

i) A copper network cable is replaced with fibre optic cable.

A

Physical

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

E) Which layer(s) of the network stack are affected by the following changes. (not including changes in the amount of network traffic).

ii) A new satelite is launched to directly connect London and Sydney.

A

ii) physical, link

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

E) Which layer(s) of the network stack are affected by the following changes. (not including changes in the amount of network traffic).

iii) A website changes from http to https.

A

application

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

Which layer(s) of the network stack are affected by the following changes. (not including changes in the amount of network traffic).

iv) A network connection is taken down for maintenance.

A

network

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

Which layer of the network stack does this belong to?

Port Number

A

Transport

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

Which layer of the network stack does this belong to?

Domain name

A

Application

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

Which layer(s) of the network stack are affected by the following changes. (not including changes in the amount of network traffic).

IP

A

Network

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

Which layer(s) of the network stack are affected by the following changes. (not including changes in the amount of network traffic).

SVN

A

Application

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

Which layer(s) of the network stack are affected by the following changes. (not including changes in the amount of network traffic).

TCP

A

Transport

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

Which layer(s) of the network stack are affected by the following changes. (not including changes in the amount of network traffic).

SSH

A

Application

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

Consider a “unix” filesystem where:

  • All i-nodes are cached in RAM
  • i-nodes have 10-direct pointers, 1 indirect pointer and 3 double indirect pointers.
  • Blocks are 8KB
  • Block pointers are 4Bytes
  • blocks are numbered from 0.

What are the maximum possible file size for this file system?

A

Block size is 8KB.

8KB/4 = 8192/4 = 2048

8 KiB * (10 + 2048 + 3* 2048^2) = 100679760 KiB = ~96.016 GiB

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

Is this a process or a thread?

A

Both

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

Is this a process or a thread?

A

Threads

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

Is this a process or a thread?

A

Both.

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

Is this a thread or a process?

A

Both.

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

List two ways a process can find out that a child process has terminated.

A
  1. Wait/waitpid
  2. sigchild handler
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

If a call to wait(&status) succeeds, which macros should be used to determine the exit status of the process?

A

WIFEXIT & WEXITSTATUS

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

Which signal can not be blocked / caught by a process?

A

SIGKILL #9

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

Which C function is used to set up a signal handler?

A

sigaction

26
Q

Show the last two lines of the file strax

A

Tail -2 strax

27
Q

Show the 17th line of the file strax

A

head 17 strax | tail -1

28
Q

Output all lines of the file file1 which contain the text: Clara > River

A

grep -n “Clara > River” file1

29
Q

Delete all files in the current directory which start with ‘s’ and and end with ‘d’, except the file sd.

A

rm s*?d

30
Q

Find all the lines in file file1 which contain the word “dinosaur” and store them in a file called london

A

grep dinosaur file1 >> london

31
Q

What does mounting do and what afffect does it have on the file hierachy?

A

Mounting enables access to a filesystem that was previously inaccessible. This could be a separate drive partition (sidenote: but it doesn’t have to be - e.g. ramfs). It grafts a subtree on to a folder within the tree of the root filesystem.

32
Q

How many immediate sub-directories does Library have?

A
  1. Number in the third column minus 2.
33
Q

What are the three parts to a HTTP message?

A

Request/Response Line

Header

Body

34
Q

What do each of the following HTTP request types do?

GET

HEAD

POST
PUT

DELETE
LINK/UNLINK

And why can we use them?

A

Get - retrieve entire document

Head - just give me the head

Post - make a new thing

Put - change an existing thing

Delete a thing

They are extra bits of information that your server might request

35
Q

What do the following HTTP status codes refer to?

100s

200s

300s

400s

500s

A

100s - informational

200s - Client request successful

300s - Redirection/further action needed

400s - Client request incomplete

500s - Server Errors

36
Q

What does DNS do?

A

DNS turns the IP address into a url that is human readable.

37
Q

What’s a file system?

A

A data structure for handling the data on a system.

38
Q

What is metadata?

A

The information about a file that’s not in the file.

Name, type, location, size, protection, owner and time/date info.

39
Q

What’s an inode?

A

A block of data that is associated with the information of the file.

40
Q

How is a file type stored?

A

Windows - as an extension (.exe)

Mac - inside the inode as metadata

Unix - file (guess based on the first 4 magic numbers in the file)

41
Q

What does each inode have? Why is it important?

A

inodes have inode number. This helps the computer find it.

42
Q

What are directory used for?

A

To map the names of files to numbers in the system.

43
Q

What is at the top of file system?

A

Slash ( / ) is at the top.

44
Q

Can you easily modify directories?

A

No, not without using specific sys calls.

45
Q

Are inodes unique?

A

Yes

46
Q

What’s a hard link?

A

Two different names but the same inode number.

When you make a hardlink you basically duplicate the reference to the inode data.

47
Q

What happens when you modify a hard-linked file?

A

It changes no matter where you access from next.

48
Q

What happens when you delete a hard linked file?

A

It decrements the reference count. If it now has a reference count of 0, then it it’s deleted off the system.

49
Q

Can you make a hard-link to a directory?

A

No, if you can hard-link directories then you can make cycles. This is a waste of space and you don’t want this.

50
Q

What’s a soft link?

A

In the lookup table, instead of linking to an inode (like a hard link), the lookup table contains the name of another linked file

51
Q

What happens when you delete a soft-linked file?

A

Nothing. Deleting the things that links to another file doesn’t modify the original.

52
Q

What happens if you have a soft-linked file and then you delete the original?

A

You have a dangling pointer.

53
Q

What is file system mounting?

A

Linking from one file system to another so that you can have multiple file systems on a sysem.

54
Q

What is an access list?

A

An access list is how we control who can access a file.

U, G, O

User, group and other.

Read, Write and Execute

55
Q

What is a mimimum unit of transfer?

A

The amount of sectors per block you can send.

56
Q

What is a sector?

A

The mimum amount you can read/write from a disk.

57
Q

What is latency?

A

The pause between trying to access a disk vs the actual start.

58
Q

What is bandwidth?

A

How long to read/write once you start going.

59
Q

What is disk fragmentation?

A

Internal fragmentation is the wasted space that a file has been allocated but isn’t used.

60
Q

What is external fragmentation?

A

Space is there but it’s all over the place.

61
Q

What is RAID?

A

Multiple disks that have the same filesystem.

62
Q
A