Network Programming (2)
Network Programming (2)
INSTRUCTLONS
I. Attempt ALL Questions
ii. Time : 1 hour
Question 1 I lOmarksl
i. System routine
11. Thread
iii. System call interface
iv. Process State
':l (b ) Differentiate between user mode and kernel modtt [2marks]
i. fo rk()
ii. getppid( )
Question 21 lOmarksl
it(a) Write the UNl.X command for performing the following : [4marks]
Question 3[10marksl
(b) A system call structure constitutes mechanism to test whether the call was successful or failed , each returning different
results . Write a sample code segment demon5trate this concept. [4marks]
Q (c) Explain the tenn context swirch. Explain how conte,t switch is carried om in processes [3marks]
,rµ}j
5 (a) Using illustration, discuss the different process states. [6marks]
With the relevant syntax., explain two principal 0fr<!1 mions ef me:Jsc.gc pe~•sfeHr. [4rnarks]
~(b)
fi,ir,iio flJ 9t tY(2if Cttf"':J ~-icm.1.
(~ , . .
Mount Kenya \~ ~} Un1vers1ty
~~~)
-
UNIVERSITY EXAMINATION 2019/2020
(c) Design multithreaded pthread program with two threads. Thread 1 - Requests
user to input and display name and telephone number. Thread 2- Requests
user to input date of birth and ID number then display the details. In our
implementation show how the two threads are synchronized. [10 Marks]
1.-...._
I'\ • "f"' r
•o'"' }J l e-' . \)
- I ', •
(v l"rs ,..,, Jl,
'
[S Marks]
(d) E.xplain five process states - l ) -o,,, ., J, I•
l~ i' I' 't
or
t rl r .,
"" '
,t, '" '1 i ,... I· ,
Ir' r• ,~ 1 -
)
c, I1, t
,, ,,I (\ - c(,Jrl':) , -:,'1+,,- 1-< I [3Marks]
(e) Explain any THREE file related sys{em calls.
(c) Write the syntax of the following socket system calls . [9 Marks]
•
1. bind () __.7 1
-- 11 . Connect()
,...
r ( ,-... 111. Listen(}
(b} With the help of diagram, discuss the elements of RPC system. [10 Marks]
(c} Describe four advantages of thread programs over the process programs.
'
[4 Marks]
(d) Explain three advantages associated with use of shared memory as form of
IPC. [6 Marks]
_ (b) Write the general structure _of a system_call.and -explain its components. -- -- -
[4 Marks]
(c) Shared memory is one of the inter-process communkation (IPC) strategies.
Explain how it works. [4 Marks]
(d) (i) Explain the concept thr~ad safene$$,_ o •'--'- _ ,p +,.,-,, _ _[2 Marks]
------