opertating system 1. The data structure where the OS will keep all information i
ID: 3801149 • Letter: O
Question
opertating system
1. The data structure where the OS will keep all information it needs to manage a process is called....
5. The routine that can be used to create a process on a Linux system is ______.
6.
If a C program read two command line arguments, like "file1", "file2" in the following command, what will be the value of the parameter "argc" of the "main" function?
./myprogram file1 file2
7. In a Linux/Unix system, which command displays the list of entries in a directory ??
12. A counting semaphore ....
18. The long-term scheduler is designed to select a new process in the main memory for the CPU. It executes much less frequently than short-term scheduler. ??
19. A critical section is a code fragment of a program that needs to exclusively access and modify a shared resource.
20.
Context-switch time is overhead and the system does no useful work while switching.
22.
Most resources used by a thread are allocated to the associated process rather than the thread itself.
24
To compile a C program "prog.c" on a Unix/Linux machine, we can type the following command.
cc -o prog prog.c
25. UNIX kernels have traditionally been implemented using a microkernel approach.
27
A process executing in user mode changes to kenel mode when it is executing kernel code during a system call.
28 Briefly describe when and why a deadlock may happen in the dining-philosophers problem. Try to give a solution to handle the deadlock.
29. solution to the critical-section problem must satisfy the following three conditions: mutual exclusion, progress, and bounded waiting.
Briefly explain each condition.
30
In the following program, please tell which lines are critical section(s) that should be guarded using mutex locks, and also explain why.
5. The routine that can be used to create a process on a Linux system is ______.
6.
If a C program read two command line arguments, like "file1", "file2" in the following command, what will be the value of the parameter "argc" of the "main" function?
./myprogram file1 file2
7. In a Linux/Unix system, which command displays the list of entries in a directory ??
12. A counting semaphore ....
18. The long-term scheduler is designed to select a new process in the main memory for the CPU. It executes much less frequently than short-term scheduler. ??
19. A critical section is a code fragment of a program that needs to exclusively access and modify a shared resource.
20.
Context-switch time is overhead and the system does no useful work while switching.
22.
Most resources used by a thread are allocated to the associated process rather than the thread itself.
24
To compile a C program "prog.c" on a Unix/Linux machine, we can type the following command.
cc -o prog prog.c
25. UNIX kernels have traditionally been implemented using a microkernel approach.
27
A process executing in user mode changes to kenel mode when it is executing kernel code during a system call.
28 Briefly describe when and why a deadlock may happen in the dining-philosophers problem. Try to give a solution to handle the deadlock.
29. solution to the critical-section problem must satisfy the following three conditions: mutual exclusion, progress, and bounded waiting.
Briefly explain each condition.
30
In the following program, please tell which lines are critical section(s) that should be guarded using mutex locks, and also explain why.
Explanation / Answer
opertating system
1. Proess table
Because, OS must maintain a data structure for each process, which describes the state and resource ownership of that process, and which enables the OS to exert control over each process.
5. fork()
6. argc will result 3.
Because, it counts number of command line arguments. program name, file1 and file2 are 3 arguments.
7. ls command
12. A) is essentially an integer variable
18. Long term scheduler exeutes less frequently beause there may be minutes in between the creation of new processes in the system, since it handles placing jobs in the system and may wait a while for a job to finish before it admits another one.
But the short-term scheduler must select a new process quite often.
19. True.
Because of parts of the program where the shared resource is accessed is protected, tt cannot be executed by more than one process.
20. Context-switch time is overhead and the system does no useful work while switching.
22. True. Because, threads use very little resources of an operating system in which they are working. That is, threads do not need new address space, global data, program code or operating system resources.
24. True
25. False. Monolithic kernels, which have traditionally been used by Unix-like operating systems, contain all the operating system core functions and the device drivers
29.Solution to Critical Section Problem:
1.Mutual Exclusion: If process Pi is executing in its critical section, then no other processes can be executing in their critical sections.
Implications:
Critical sections better be focused and short.
Better not get into an infinite loop in there.
If a process somehow halts/waits in its critical section, it must not interfere with other processes.
2. Progress: If no process is executing in its critical section and there exist some processes that wish to enter their critical section, then the selection of the processes that will enter the critical section next cannot be postponed indefinitely.
If only one process wants to enter, it should be able to.If two or more want to enter, one of them should succeed.
3. Bounded Waiting. A bound must exist on the number of times that other processes are allowed to enter their critical sections after a process has made a request to enter its critical section and before that request is granted.
Assume that each process executes at a nonzero speed
No assumption concerning relative speed of the n processes.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.