CS313 Computer Systems & Concurrency

Attempt THREE questions
Calculators are NOT permitted

Q.1 (a) Is i++; an atomic operation (in Java) on the int variable i? Give a brief
(2 marks)
(b) Briefly describe the differences between processes and threads in
(2 marks)
(c) i) What is the meaning of the term liveness in the context of
ii) Briefly describe the three most common liveness problems. You
may use examples to illustrate your description.
(4 marks)
(d) lock() and tryLock() are methods of which Java interface? Name one
Java class that implements this interface.
(2 marks)
(e) Can constructors be synchronized in Java? Give a brief explanation.
(2 marks)
(f) An application that creates an instance of Thread must provide the
code that will run in that thread. There are two ways to do this:
provide a Runnable object or subclass the Thread class. Give a brief
explanation focusing on the advantages and the disadvantages of
each technique.
(3 marks)
(g) What is the output (i.e. printed) of the following code? Give a brief
public class MultiThreading {
private static class MyThread extends Thread {
public MyThread(ThreadGroup tg, String name) {
super(tg, name);
public void run() {
CS313 Page 3 of 5
public static void main(String[] args) {
ThreadGroup myThreadGroup = new ThreadGroup(“myThreadGroup”);
MyThread myThread = new MyThread(myThreadGroup, “myThread”);
(5 marks)
Q.2 (a) Briefly describe the following Java Thread states: RUNNABLE,
(3 marks)
(b) According to the Java API, specify two methods that can change the
state of a thread from RUNNABLE to WAITING.
(2 marks)
(c) Briefly describe the difference between the notify() and notifyAll()
(2 marks)
(d) Briefly describe the differences between daemon and non-daemon
threads in Java.
(2 marks)
(e) Briefly describe three techniques available to Java programmers to
implement synchronization. You may use examples to illustrate your
(3 marks)
(f) (i) Briefly describe the following mutation operators for concurrency:
o MSP – Modify Synchronized Block Parameter
o RSB – Remove Synchronized Block
o RCXC – Remove Concurrency Mechanism Method-X Call
o RFU – Remove Finally Around Unlock
(ii) Specify which concurrency bug pattern each mutator operator can
(8 marks)
CS313 Page 4 of 5
Q.3 (a) What is the difference between client-server and peer-to-peer architecture?
(2 marks)
(b) What is the response time to request and receive a file on a non-persistent
HTTP connection? Explain why it takes this long.
(3 marks)
(c) Explain how a HTTP request is handled when a network uses a web cache.
(4 marks)
(d) (i) Given the following data calculate the UDP checksum:
1000 0110 0101 1110
1010 1100 0110 0000
0111 0001 0010 1010
1000 0001 1011 0101
Show your working.
(4 marks)
(ii) Given the data and the checksum received at the receiver how do you
check if it is corrupt?
(1 mark)
(e) What are all the situations that can occur in a stop and wait reliable data transfer
protocol when sending data? How are these situations handled?
(6 marks)
Q.4 (a) Explain the functions of the network layer.
(2 marks)
(b) What network architecture does the Internet use? Name an alternative
architecture and how it differs.
(2 marks)
(c) What protocol is used to assign hosts IP addresses? How does this protocol
(5 marks)
(d) What is the main difference between IPv4 and IPv6?
(1 mark)
(e) Describe possible services offered by a link layer protocol.
CS313 Page 5 of 5
(5 marks)
(f) Explain the simplest form of parity checking. Give an example.
(2 marks)
(g) Describe 3 properties of link layer switching.
(3 marks)

Powered by WordPress