


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
The instructions and questions for an exam in the bachelor of science (honours) in software development and computer networking – stage 3 program at cork institute of technology. The exam covers topics such as pipe usage, network daemons, rpc, shared memory, and sockets. Students are required to answer five questions, each carrying equal marks.
Typology: Exams
1 / 4
This page cannot be seen from the preview
Don't miss anything!
(NFQ – Level 8)
Instructions Answer FIVE questions. All questions carry equal marks. Method declarations are on the last page
Examiners: Ms. Helen Fagan Dr. D. Chambers Mr. P. O’Connor Mr. E. A. Parslow
Question 1 (a) Write a program to show how a pipe can be used to send a message from a child process to its parent. The child process should take input from the user and send it to the parent. The parent process should then print this message. (8 marks)
(b) Explain when you would use the dup system call. (4 marks)
(c) Explain the significance of the return value of the wait and the fork system call_._ (4 marks)
(d) Write a program that receives and prints a message whenever it receives a SIGQUIT. (4 marks)
Question 2 (a) What is a network daemon? (2 marks)
(b) Describe the purpose of the super server process inetd on Linux. (4 marks)
(c) Describe the basic architecture of the super server program. (6 marks)
(d) Describe with the aid of an example the format of an entry in the inetd.conf file and the /etc/services file. (8 marks)
Question 3
(a) Explain the role of the port mapper in RPC. (4 marks)
(b) Describe with the aid of a diagram the sequence of events that occur from the point where a remote procedure is called until the procedure returns. (6 marks)
(c) Write a file student.x that you would use as a basis for an RPC program. The program should allow a client to:
Question 4
(a) Write a program that creates a block of shared memory to store an array of 1024 characters. The shared memory block should have permissions (rw-rw-rw-). The agreed key is the filename ‘file.txt’and the letter ‘x’. The program should take a string from the user and write it into the start of the shared memory block. (14 marks) (b) What is the purpose of a semaphore? (2 marks)
(c) What information does the operating system store for each semaphore group created? (4 marks)
Question 5
(a) What information identifies a specific socket? (2 marks)
(b) Write the code for an iterative connectionless server that waits continually for requests from clients. For each request it
(c) Explain the effect of the following system call where socket_fd is a socket file descriptor.
fcntl( socket_fd, F_SETFL, O_NONBLOCK); (6 marks)
Method Declarations
int accept(int sockfd, void *addr, int *addrlen)
int alarm(int seconds) int bind(int sockfd, struct sockaddr *my_addr, int addrlen) int close(int fd) int execlp(const char * file , const char * arg , ...) int execv (const char filename, char const argv [] ) key_t ftok(char filenamae, char c) int fork() int fprintf (FILE stream, char* message); uint16_t htons(uint16_t hostshort ); char inet_ntoa(struct in_addr in ); _int kill(int processId, int signal) int listen(int sockfd, int backlog) int memcpy (char * dest, char string, int size)_ int pclose( FILE* fp) FILE* popen(char* command, char mode); int pipe (int* fileDescirptorArray) int read (int fileDescriptor, char* string, int n) int recv(int sockfd, void *buf, int len, unsigned int flags) int recvfrom(int sockfd, void *buf, int len, unsigned int flags struct sockaddr * address , socklen_t address_len ) int send(int sockfd, const void *msg, int len, int flags) int sendto(int sockfd, const void *msg, int len, int flags const struct sockaddr * dest_addr , socklen_t dest_len )
void shmat(int shmid, void shmaddr, int shmflg) int shmdt(void *shmaddr) int shmget(key_t key, size_t size, int shmflg) int signal (int signalNumber, void (func) (int)) int socket(int domain, int type, int protocol) _int strcpy (char * dest, char* string) int wait(int status) int write (int fileDescriptor, char string, int n)_