Final Exam - Practice Questions Flashcards
Prep for Final
How do you map a virtual address to a physical one?
- Use integer division to find the page.
Page = Virtual Address / Page Size
- Calculate the offset offset= virtual address % page size
- Find the frame by mapping the page to a frame via the page table
- physical address=frame∗(page size)+offset
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
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 many immediate subdirectories does this directory have?
241772 drwx—— 5 uqjfenw1 uusers 56 Sep 16 12:14 ass3
241772 drwx—— 5 uqjfenw1 uusers 56 Sep 16 12:14 ass3
- The 3rd column minus 2. The parent directory and this directory itself.
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
Nothing. Hard links point to the memory location, not the file. So changing the file name doesn’t change its contents.
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?
Need to export it to the path.
Export PATH = $PATH:home/grum.py
Which command(s) would I need to run in order to allow all users to execute a binary file called smoketest?
chmod a+x smoketest
Which layer(s) of the network stack are affected by the following changes:
i) A copper network cable is replaced with fibre optic cable.
Physical
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.
ii) physical, link
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.
application
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.
network
Which layer of the network stack does this belong to?
Port Number
Transport
Which layer of the network stack does this belong to?
Domain name
Application
Which layer(s) of the network stack are affected by the following changes. (not including changes in the amount of network traffic).
IP
Network
Which layer(s) of the network stack are affected by the following changes. (not including changes in the amount of network traffic).
SVN
Application
Which layer(s) of the network stack are affected by the following changes. (not including changes in the amount of network traffic).
TCP
Transport
Which layer(s) of the network stack are affected by the following changes. (not including changes in the amount of network traffic).
SSH
Application
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?
Block size is 8KB.
8KB/4 = 8192/4 = 2048
8 KiB * (10 + 2048 + 3* 2048^2) = 100679760 KiB = ~96.016 GiB
Is this a process or a thread?
Both
Is this a process or a thread?
Threads
Is this a process or a thread?
Both.
Is this a thread or a process?
Both.
List two ways a process can find out that a child process has terminated.
- Wait/waitpid
- sigchild handler
If a call to wait(&status) succeeds, which macros should be used to determine the exit status of the process?
WIFEXIT & WEXITSTATUS
Which signal can not be blocked / caught by a process?
SIGKILL #9