0% found this document useful (0 votes)
8 views

Network Programming (2)

The document is an examination paper for a course on Network Programming, covering various topics such as system calls, process states, and multithreading. It consists of multiple questions requiring explanations, code writing, and differentiation of concepts related to operating systems and networking. Students are instructed to attempt all questions within a time limit of two hours.

Uploaded by

shehmarl
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Network Programming (2)

The document is an examination paper for a course on Network Programming, covering various topics such as system calls, process states, and multithreading. It consists of multiple questions requiring explanations, code writing, and differentiation of concepts related to operating systems and networking. Students are instructed to attempt all questions within a time limit of two hours.

Uploaded by

shehmarl
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

BIT 4205- NE1'VORK PROGRAMi\·lli~G -CAT l(DAY)

INSTRUCTLONS
I. Attempt ALL Questions
ii. Time : 1 hour

Question 1 I lOmarksl

'\ (a) E,plain the follo\\ tOg co111:epts [4marks]

i. System routine
11. Thread
iii. System call interface
iv. Process State
':l (b ) Differentiate between user mode and kernel modtt [2marks]

a (c) Explain the function of the follo\.ving process routines: [4rnarks]

i. fo rk()
ii. getppid( )

\\'rite the S)11ta, for each routi11e .

Question 21 lOmarksl

it(a) Write the UNl.X command for performing the following : [4marks]

a. Reading file content


b. Deleting directory
c. Copying file
d. Changing directories
g_(b ) Explain the difference between sys1e11·1call andfimction call, Use examples. [4rnarks]
'\- (c) Explain any rwofw1c1ions ofkemd. [~marks]

Question 3[10marksl

~ (a) Explain the code segment given below: [3marks]

\ fd = creat("mydata . txt", S_IREAD S_IWRITE);

(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]

Question 411 Omarks j

,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

SCHOOL OF COMPUTING AND INFORMATICS 1

DEPARTMENT OF INFORMATION TECHNOLOGY

BACHELOR OF BUSINESS INFORMATION TECHNOLOGY


REGULAR

UNIT CODE: BIT4205 UNIT mLE: NETWORK PROGRAMMING

DATE: DECEMBER 2019 MAIN EXAM TIME: 2 HOURS

INSTRUCTIONS: ANSWER QUESTION ONE {COMPULSORY) AND ANY OTHER


TWO QUESTIONS

Question One { 30 Marks) : Compulsory


(a) Briefly explain the paradigm of networking programming. Give a suita ble
language for network programming. [4 Ma rks]

(b) In context of operating systems, explain t he foilov•.dng conce 1) ':5.


1. System call interface [2 Marks]
11. Inter process communication [2 Marks]
111. Critical section (2 Marks]
iv. Shell [2 Marks]

(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,
'

• ' I l ,, I I ' ,,,,,, I ,1,


- (• I )

[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.

Question Two (20 Marks)


. help of diagram,
(a) With . .
discuss t of UNIX operating systems.
the core componellJ_
\ . , [9 Marks]
i. Kernel
11. Shell

111. Commands, Utilities and applications


-.. ~- "'-

(b) Explain the term socket. [2 Marks]


) ,-.. . \

(c) Write the syntax of the following socket system calls . [9 Marks]

1. bind () __.7 1
-- 11 . Connect()
,...
r ( ,-... 111. Listen(}

Question Three (20 Marks}


(a} Write a simple process program that create:; a new process and return its
process id (PIO). ,,;,, [6 Marks]

(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]

l__ Question Four (20 Marks)


(a} Explain the concept Remote Procedure Call.
[2 Marks]

(b} Explain two primary goals of operating systems.


[4 Marks]
(c) Write the syntax for the following socket related system calls. Explain the
syntax components
i. accept() [4 Marks]
ii. close( ) [4 Marks]

(d) Explain three advantages associated with use of shared memory as form of
IPC. [6 Marks]

J Question 5 (20 Marks)


(a) Discuss five Characteristics of UNIX Threads. [10 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]
------

You might also like