1. A thread differs from a process in that, among other
things:
(a) It can be created at a lower cost.
(b) It provides more data isolation than a process.
(c) Switching threads of one process is faster than switching
different processes.
(d) Communication of threads requires IPC mechanisms.
(e) Processes can only be run by a judge.
2. What error/problem occurs in the following code:
from threading import Thread, Lock
l1 = Lock()
l2 = Lock()
def thr1():
with l1:
with l2:
print("Peek-a-boo
1!")
def thr2():
with l2:
with l1:
print("Peek-a-boo
2!")
def main():
t1 = Thread(target=thr1)
t2 = Thread(target=thr2)
t1.start()
t2.start()
if __name__ == "__main__":
main()
(a) Race condition.
(b) Data starvation of *one* of the threads.
(c) Semaphores should be used instead of locks.
(d) Possibility of a deadlock.
(e) No error - the program will definitely work
correctly.
3. What are (among other things) the differences between a binary
semaphore and a lock?
(a) A semaphore has information about which thread acquired
it, while a lock does not.
(b) A lock has information about which thread acquired it,
while a semaphore does not.
(c) A binary semaphore works more efficiently.
(d) A semaphore can be used in algorithms where another
thread
increments and another decrements the semaphore; this is impossible
for a lock.
(e) A semaphore only occurs at railroad crossings.
4. Among other things, what are the differences between sockets
using the TCP
and UDP protocols?
(a) TCP has a smaller system overhead.
(b) UDP ensures that packets are delivered in the correct
order, while TCP does not.
(c) UDP can be used for multicast transmissions, while TCP
cannot.
(d) UDP is stateless, while TCP is not.
(e) There is no difference: these are the two names for the
same protocol.
5. In which application should we consider using UDP, instead of
TCP?
(a) Video transmission.
(b) Transmission of large binary data files.
(c) VoIP transmission.
(d) Single packet transmission.
(e) It is always better to use UDP, because TCP sucks and
nobody uses it.
6. What are the advantages of the NFS filesystem?
(a) Great scalability on large clusters and
supercomputers.
(b) Simplicity and high popularity.
(c) Dynamic development in the recent years.
(d) Security achieved by data replication.
(e) NFS has no advantages and nobody uses it.
7. DNS traditionally has been using UDP for:
(a) Transferring zone files.
(b) Sending requests and responses.
(c) Communications using DNSSEC.
(d) All transmissions.
(e) None of the above.
8. What is the disadvantage of using threads to serve various
connections in a
server?
(a) Relatively hogh system overhead of a thread.
(b) Vulnerability to a DDoS attack, by enforcing creation of
an outrageous number of
threads.
(c) The threads do not assure enough data separation.
(d) This is forbidden by the law.
1. A thread differs from a process in that, among other things: (a) It can be created at a lower cost. (b) It provides
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am