The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Can answer PART 3 No. 3 please? Thanks a lot! I need logic and steps.
Â
Â
3. (15 marks) A simple virtual memory system has 32KB physical memory with 16-bit
virtual address, of which 12 bits are used as offset. The current content of its page
table is given below:
Virtual Page
Number
Page Frame
Bits
Present /
Absent bit
15 000 0
14 010 1
13 000 0
12 000 0
11 111 1
10 000 0
9 101 1
8 000 0
7 000 0
6 000 0
5 011 1
4 100 1
3 000 1
2 110 1
1 001 1
0 000 0
a) What is the page size of this virtual memory system?
b) What is the corresponding physical address of virtual address EA0C (in
hexadecimal notation)?
c) What would happen if the CPU executes an instruction to move an integer from
memory address C6A0 (hexadecimal) to a register?
Â
Â
ICT310 Examination, Semester 2, 2010 Page 1 ICT310 Operating Systems and Systems Programming Final Examination
Semester 2, 2010 Time Allowed 3 hours plus 10 minutes reading time
INSTRUCTIONS
1.
2.
3.
4.
5.
6.
7. There are 22 pages in this Paper, including 4 blank pages at the end.
The questions are divided into three parts with a total of 150 marks.
Part I consists of 50 multiple-choice questions, worth 1 mark each and 50 marks in total.
Part II consists of 8 questions, worth a total of 50 marks.
Part III consists of 4 questions, worth a total of 50 marks.
Attempt all questions.
For questions in Part I, circle the letter of the choice that best answers or best completes each
question. For questions in other parts, just write your answer directly on this Paper in the space
below each question.
8. If more space is required, continue your answer on the blank pages at the end. Make clear on the
original page that your answer is to continue on a blank page and give the page number.
9. Use the back of each page for rough notes if required. Your Name: _________________________________________ Your Student Number:_________________________________ Your Signature:_______________________________________ EXAMINATION AID ALLOWED
Provided by the University
Nil Provided by the Candidate
Closed Book Examination – No Calculators Permitted ICT310 Examination, Semester 2, 2010 Page 1 Part I: Multiple-Choice Questions. Circle the letter of the choice that best answers or best
completes each of the following questions (1 mark x 50 = 50 marks).
Note each question has between four and six choices labeled a, to f. You should read all
choices before answering the question as some questions may span over two pages.
1. The instruction execution cycle consists of the following stages:
a. Execute Stage -> Fetch Stage
b. Fetch Stage -> Execute Stage -> Output Stage
c. Fetch Stage -> Execute Stage -> Interrupt Stage
d. Interrupt Stage -> Fetch Stage -> Execute Stage 2. A fetched instruction is normally loaded into the:
a. Instruction Register (IR)
b. Program Counter (PC)
c. Accumulator (AC)
d. None of the above 3. Which of the following statements about DMA is incorrect?
a. DMA transfers data between memory and disk.
b. Unlike Interrupt driven I/O, DMA does not use interrupt.
c. DMA relieves processor the responsibility for data transfer.
d. DMA is more efficient for transferring large blocks of data. 4. When an interrupt is detected, which of the following registers is saved automatically
by the hardware?
a. IR
b. MAR
c. MBR
d. PC 5. The operating system provides many types of services to end-users, programmers
and system designers, including:
a. Built-in user applications
b. Error detection and response
c. Relational database capabilities with the internal file system
d. All of the above 6. A technique in which a process, executing an application, is divided into threads that
can run concurrently is called:
a. Multithreading
b. Multiprocessing
c. Symmetric multiprocessing (SMP)
d. None of the above ICT310 Examination, Semester 2, 2010 Page 2 7. A Memory Table is an OS control structure that is used by the OS to:
a. Manage I/O devices
b. Manage processes
c. Provide information about system files
d. None of the above 8. The Process Image element that contains the modifiable part of the user space is
called the:
a. User Program
b. System Stack
c. Process Control Block
d. None of the above 9. A process switch may occur when the system encounters an interrupt condition, such
as that generated by a:
a. Memory fault
b. Supervisor call
c. Trap
d. All of the above
10. In a typical Unix system, the virtual address space allocated to a process contains
the following region(s):
a. Text region (program instructions)
b. Data region
c. Heap
d. Stack
e. Environment
f. All of the above
11. Which of the following statements about fork system call is false?
a. The fork call creates a child process by duplicating itself
b. Initially both the parent process and the child process that is created by fork
contain the same program and data
c. In the parent process, the fork call returns the pid of the child process. In the
child process, the fork call returns the pid of the parent process
d. Immediately after the fork call, it is unpredictable whether the parent process or
the child process would run first 12. Given the following Unix code excerpt:
execl("/bin/ls", "ls", (char *)0);
printf("end of ls\n"); ICT310 Examination, Semester 2, 2010 Page 3 What is the most likely output from the above code?
a. Listing of the filenames in the current directory
b. Listing of the filenames in the current directory followed by the line "end of ls"
c. An error message
d. No output will be generated
13. What does the system call _exit do?
a. Close all file descriptors in the calling process
b. Release the memory allocated to the calling process
c. Terminate the calling process
d. Notify the parent of the calling process that its child has terminated
e. Pass the exit status to the parent process
f. All of the above
14. Which of the following statements about the system call wait is true?
a. System call wait causes the calling process to wait for specified number of
seconds
b. System call wait causes the calling process to wait for another process until the
later is ready
c. System call wait returns when the parent of the calling process dies
d. System call wait can be used to obtain the termination status of its child
processes
e. None of the above
15. Which of the following statements about process group is false?
a. Each process belongs to one process group
b. A process group has a group leader whose pid equals to the group id
c. The leader of a process group can put any process into its process group
d. A process is normally placed in the same group as that of its parent process
16. Which of the following statements about daemon process is false?
a. A daemon process is usually a server process
b. Each daemon process has a controlling terminal
c. A daemon process usually keeps running until the machine is shut down
d. A daemon process usually reports error and diagnostic information by writing a
message to a log file ICT310 Examination, Semester 2, 2010 Page 4 17. What information is stored in the system-wide File Table in a classic Unix system?
a. I-node information, file length, file status flags
b. I-node information, V-node information, current file size
c. File status flags, current file offset, v-node pointer
d. None of the above
18. What information is stored in the system-wide V-Node Table in a classic Unix
system?
a. I-node information, file length, file status flags
b. I-node information, V-node information, current file size
c. File status flags, current file offset, v-node pointer
d. None of the above
19. Assuming that a file is opened in two different processes, which of the following
statements is true?
a. The file is represented by one new entry in the File Table and one entry in the
V-Node Table
b. The file is represented by two new entries in the File Table and one entry in the
V-Node Table
c. The file is represented by one new entry in the File Table and two entries in the
V-Node Table
d. The file is represented by two new entries in the File Table and two entries in
the V-Node Table
20. It is well known that when reading and writing a disk file, the size of the buffer used
in the program can affect I/O performance. How would you select the buffer size in
order to improve I/O efficiency?
a. Use a buffer whose size is a multiple of 1000
b. Use a buffer whose size is a multiple of 1024
c. Use a buffer whose size is a multiple of the disk block size
d. Use a buffer whose size is as big as possible
21. Given the following Unix code excerpt:
int fd = open("data.txt", O_WRONLY | O_CREAT, 0666);
dup2(fd, STDOUT_FILENO);
What does the above code achieve?
a. Open a file named "data.txt" and then duplicate it
b. Open a file named "data.txt" and then copy it to file "STDOUT_FILENO"
c. Redirect file "data.txt" to standard output
d. Redirect the standard output to file "data.txt" ICT310 Examination, Semester 2, 2010 Page 5 22. Assuming a directory contains two regular files named "abc" and "xyz", what would be
the content of that directory file?
a. The contents of the files "abc" and "xyz"
b. The file names "abc" and "xyz" c. The file name and i-node number mapping for files "abc" and "xyz" d. The file name and i-node number mapping for files "abc" and "xyz" as well as the inode numbers of the directory itself and its parent directory 23. Which of the following system calls would you use to obtain the i-node information of a
file?
a. lseek
b. fstat c. umask d. chmod 24. Which signal would be sent to the foreground processes by pressing Ctrl-C on the
keyboard?
a. SIGKILL
b. SIGCHILD c. SIGQUIT d. SIGINT 25. What does the following system call do?
alarm (10);
a. Sounds alarm for 10 seconds b. Sleep for 10 seconds c. Send SIGALRM signal to the calling process 10 seconds later d. Suspend the calling process until SIGALRM signal is received 26. What does the following system call do?
pause();
a. Pause the calling process for 1 second b. Suspend the calling process until a signal is received and processed. c. Pause the calling until SIGALRM is received d. Pause the calling process until its child process catches up 27. What is the effect of the following function call to the calling process?
signal(SIGINT, SIG_IGN); ICT310 Examination, Semester 2, 2010 a. Send signal SIGINT to the foreground processes b. Install signal handler for SIGINT c. Pressing Ctrl-\ will not kill the calling process d. Page 6 Pressing Ctrl-C will not kill the calling process 28. In the reliable signal model, a signal is "pending" means
a. the signal is not yet generated b. the signal is generated but not yet processed c. the signal is ignored d. the signal is caught 29. Which system call would you use to unblock certain signals?
a. Signaction b. sigpromask c. sigpending d. signal 30. Which system call would you use to check whether any blocked signal has arrived?
a. signaction b. sigpromask c. sigpending d. signal 31. Which of the following statements about unnamed pipes is false?
a. A pipe can only be used to communicate between processes sharing a common
ancestry in which the pipe was created b. If a pipe is empty, a system call to read from the pipe will return 0 c. If a pipe is full, a system call to write to the pipe is suspend d. If the read end of a pipe is closed, any process that attempts to write to the pipe will
be sent signal SIGPIPE e. If the write end of a pipe is closed, any process that attempts to read from the pipe
will return immediately 32. Message queue is a type of interprocess communication mechanism. Which of the
following statements about message queues is false?
a. A message queue allows two processes to communicate by sending a message to
the message queue in one process and by retrieving the message from the
message queue in another process
b. A message queue is removed from the system automatically when the process that
created the message queue is terminated ICT310 Examination, Semester 2, 2010 Page 7 c. A message in a message queue consists of a priority number and a message body d. To create a new message queue, you must use a key that is not already used by
any existing message queue in the system 33. In Unix programming, mutual exclusion can be implemented by using
a. Multiple threads b. A binary semaphore c. Signals d. All of the above 34. In operating systems, the Producer-Consumer Problem is used to
a. Produce items for consumption b. Illustrate and test the synchronization of multiple processes c. Implement semaphores d. Generate random numbers 35. Which of the following statements about UDP is false?
a. UDP is a connectionless protocol b. UDP preserves message boundaries c. UDP provides sequencing d. UDP incurs less overhead compared with TCP f. None of the above 36. In a network application using TCP, what is the system call connect used for?
a. The client uses the system call to create a connection with the server b. The server uses the system call to create a connection with the client c. Both the client and the server use the system call to establish a connection with
each other d. connect is not a valid system call 37. In a network application using TCP, what is the system call accept used for?
a. The client uses the system call to receive a message from the server b. The server uses the system call to receive a message from the client c. The client uses the system call to wait for a server connection request d. The server uses the system call to wait for a client connection request 38. In a network application using TCP, what is the system call bind used for?
a. The client must use the system call to bind an address to the client socket ICT310 Examination, Semester 2, 2010 Page 8 b. The server must use the system call to bind an address to the server listening
socket c. The client and server use the system call to bind each other d. A TCP application does not have to use the system call 39. Key issues involved in the design of multiprocessor operating systems include:
a. Scheduling
b. Synchronization
c. Reliability and fault tolerance
d. All of the above
40. Examples of solutions to the concurrency problem that do not involve busy waiting are
the following:
a. Semaphores and monitors
b. Message passing and caching
c. Producers and consumers
d. None of the above
41. In a system employing message queues, a typical message is divided into two
primary sections:
a. Header and mailbox
b. Body and mailbox
c. Destination ID and Source ID
d. None of the above 42. In deadlocked process recovery, selection criteria for choosing a particular process to
abort or rollback includes designating the process with the:
a. Most estimated time remaining
b. Lowest priority
c. Least total resources allocated so far
d. All of the above 43. The Dining Philosopher’s Problem is a standard test case for evaluating approaches
to implementing:
a. Deadlock
b. Starvation
c. Synchronization
d. All of the above 44. In a system employing a segmentation scheme for memory management, a process is
divided into:
a. One segment per thread
b. A number of segments which must be of equal size
c. A number of segments which need not be of equal size ICT310 Examination, Semester 2, 2010 Page 9 d. None of the above
45. The real address of a word in memory is translated from the following portions of a
virtual address:
a. Page number and frame number
b. Page number and offset
c. Frame number and offset
d. None of the above
46. Segmentation has a number of advantages to the programmer over a non-segmented
address space, including:
a. Simplifying the handling of growing data structures
b. Sharing among processes
c. Protection
d. All of the above
47. The replacement policy that is impossible to implement because it would require the
O/S to have perfect knowledge of future events is called the:
a. Optimal policy
b. Least recently used (LRU) policy
c. Clock policy
d. None of the above
48. In terms of frequency of execution, the short-term scheduler is usually the one that
executes:
a. Most frequently
b. Least frequently
c. About the same as the other schedulers
d. None of the above
49. A typical way to overcome starvation of lower-priority processes in a priority-based
scheduling system is to:
a. Change a process priority randomly
b. Change a process priority with its age
c. Round-robin cycling of processes in a priority queue
d. All of the above
50. The primary objective in designing the I/O facility of a computer system that deals with
the desire to handle all I/O devices in a uniform manner is referred to as:
a. Efficiency
b. Generality
c. Directory management
d. None of the above ICT310 Examination, Semester 2, 2010 Page 10 Part II. Complete the following system programming questions. There are 8 questions in this
part worth a total of 50 marks. Write your answer directly in the space under each question.
1. (5 marks) Write a program that reads a line of input from the standard input and then
reverse the line. Finally print out the reversed line on the standard output. 2. (6 marks) Write a program that 1) prints a list of its environment variables (and their
values); and 2) print out the current directory of the process as well as the user who
invokes the program. ICT310 Examination, Semester 2, 2010 Page 11 3. (6 marks) Assuming the existence of a text file named foo, write a C program to read the
last 20 bytes of the file and print them on the standard output. 4. (7 marks) Write a C program fragment to demonstrate how the standard input of a
process may be redirected away from the terminal keyboard to a file. ICT310 Examination, Semester 2, 2010 Page 12 5. (6 marks) Write a UNIX program to demonstrate how a child process passes a message
to its parent process using an unnamed pipe. 6. (7 marks) Write a C function with the following function prototype:
int CreateProcesses(int n)
The function creates n direct child processes (i.e., the parent of each child process is
the calling process). Each child process would print out its own PID and exit. The
function returns the number of child processes it has created, or -1 if it has
encountered error in creating a child process. ICT310 Examination, Semester 2, 2010 Page 13 7. (6 marks) The following code segment demonstrates how to install a signal handler
named sig_handler (you do not have to provide any header files):
void sig_handler(int signo)
{
// body of signal handler
} for a given signal sig:
struct sigaction act;
act.sa_flags = 0;
act.sa_handler = sig_handler;
sigfillset( & (act.sa_mask) );
if (sigaction(sig, &act, NULL) != 0) {
perror("sigaction"); exit(1);
} Write statements to perform the following operations:
a) ignore signal SIGINT.
b) restore the signal handler for SIGINT to its default one.
c) catch signal SIGINT, so that when the process receives the signal, it prints out
the numerical value of the signal ICT310 Examination, Semester 2, 2010 Page 14 8. (7 marks) Give the program skeletons for a client-server pair that communicates with
each other using TCP sockets. You need to give the correct names and sequence of the
socket-related system calls but not necessarily every details of the parameters required
by those system calls. ICT310 Examination, Semester 2, 2010 Page 15 Part III. Complete the following operating system theory questions. There are 4 questions in
this part, worth a total of 50 marks. Write your answer directly in the space under each
question.
1. (10 marks) List the five states in the Five-State Process Model. Draw the state
transition diagram for the model. Briefly explain each state transition in the diagram. 2. (10 marks) Describe the Round Robin algorithm for process scheduling. ICT310 Examination, Semester 2, 2010 3. Page 16 (15 marks) A simple virtual memory system has 32KB physical memory with 16-bit
virtual address, of which 12 bits are used as offset. The current content of the page
table of a process is given below:
Virtual Page
Number
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0 Page Frame
Bits
000
010
000
000
111
000
101
000
000
000
011
100
000
110
001
000 Present /
Absent bit
0
1
0
0
1
0
1
0
0
0
1
1
1
1
1
0 (a) What is the page size of this virtual memory system?
(b) What is the corresponding physical address of virtual address EA0C (in hexadecimal
notation)?
(c) What would happen if the CPU executes an instruction to move an integer from
memory address C6A0 (hexadecimal) to a register?
(d) What are the advantages and disadvantages of keeping the page table in the main
memory? (you can continue your answer in the next page.) ICT310 Examination, Semester 2, 2010 (you can continue your answer in this page.) Page 17 ICT310 Examination, Semester 2, 2010 4. Page 18 (15 marks) Describe how the Inverted Page Table works. You should use diagrams
and examples to help illustrate the concept. Discuss the strength and weakness of the
inverted page tables. END OF QUESTIONS ICT310 Examination, Semester 2, 2010 Blank page 1 Page 19 ICT310 Examination, Semester 2, 2010 Blank page 2 Page 20 ICT310 Examination, Semester 2, 2010 Blank page 3 Page 21 ICT310 Examination, Semester 2, 2010 Blank page 4 Page 22