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
Which C function is used to set up a signal handler?
sigaction
26
Show the last two lines of the file strax
Tail -2 strax
27
Show the 17th line of the file strax
head 17 strax | tail -1
28
Output all lines of the file file1 which contain the text: Clara \> River
grep -n "Clara \> River" file1
29
Delete all files in the current directory which start with ‘s’ and and end with ‘d’, except the file sd.
rm s\*?d
30
Find all the lines in file file1 which contain the word “dinosaur” and store them in a file called london
grep dinosaur file1 \>\> london
31
What does mounting do and what afffect does it have on the file hierachy?
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
How many immediate sub-directories does Library have?
60. Number in the third column minus 2.
33
What are the three parts to a HTTP message?
Request/Response Line Header Body
34
What do each of the following HTTP request types do? GET HEAD POST PUT DELETE LINK/UNLINK And why can we use them?
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
What do the following HTTP status codes refer to? 100s 200s 300s 400s 500s
100s - informational 200s - Client request successful 300s - Redirection/further action needed 400s - Client request incomplete 500s - Server Errors
36
What does DNS do?
DNS turns the IP address into a url that is human readable.
37
What's a file system?
A data structure for handling the data on a system.
38
What is metadata?
The information about a file that's not in the file. Name, type, location, size, protection, owner and time/date info.
39
What's an inode?
A block of data that is associated with the information of the file.
40
How is a file type stored?
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
What does each inode have? Why is it important?
inodes have inode number. This helps the computer find it.
42
What are directory used for?
To map the names of files to numbers in the system.
43
What is at the top of file system?
Slash ( / ) is at the top.
44
Can you easily modify directories?
No, not without using specific sys calls.
45
Are inodes unique?
Yes
46
What's a hard link?
Two different names but the same inode number. When you make a hardlink you basically duplicate the reference to the inode data.
47
What happens when you modify a hard-linked file?
It changes no matter where you access from next.
48
What happens when you delete a hard linked file?
It decrements the reference count. If it now has a reference count of 0, then it it's deleted off the system.
49
Can you make a hard-link to a directory?
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
What's a soft link?
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
What happens when you delete a soft-linked file?
Nothing. Deleting the things that links to another file doesn't modify the original.
52
What happens if you have a soft-linked file and then you delete the original?
You have a dangling pointer.
53
What is file system mounting?
Linking from one file system to another so that you can have multiple file systems on a sysem.
54
What is an access list?
An access list is how we control who can access a file. U, G, O User, group and other. Read, Write and Execute
55
What is a mimimum unit of transfer?
The amount of sectors per block you can send.
56
What is a sector?
The mimum amount you can read/write from a disk.
57
What is latency?
The pause between trying to access a disk vs the actual start.
58
What is bandwidth?
How long to read/write once you start going.
59
What is disk fragmentation?
Internal fragmentation is the wasted space that a file has been allocated but isn't used.
60
What is external fragmentation?
Space is there but it's all over the place.
61
What is RAID?
Multiple disks that have the same filesystem.
62