Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Assignment 2

COM 405 Module 2

Submitted By: “Glenroy Baptiste”


Submitted to: “ Professor Paul Mancini

1. Investigate how Java handles threads. A Java application can have several threads.
Is this consistent with the basic notion of threads in the OS?
Ans. Upon examining Java's thread handling mechanism; I discovered that threads are lightweight
processes. It is possible to split up a single process into several threads. The primary benefit of
using threads in the user space is how quickly data can be switched between two threads. Creating
the runnable interface or inheriting the class in part. More is manipulating thread objects,
generating multiple threads, and customizing the thread method. In other words, a Java application
can have several threads, which is comparable to the operating system's multithread ideas.

2. Discuss the importance of the process descriptor (PCB). What data does it contain?
Is there any other relevant data about a process that would need to be included in the
PCB?
Ans. In operating systems, a process is represented by a process descriptor or process control
block (PCB). Important information about the process is contained in the Process Control
Block, such as:

 Process State: the current state of the process i.e., whether it is ready, running, waiting,
or whatever.
 Unique identification of the process in order to track "which is which" information.
 A pointer to parent process.
 Similarly, a pointer to child process (if it exists).
 The priority of process (a part of CPU scheduling information).
 Pointers to locate memory of processes.
 A register save area.
 The processor it is running on.
The operating systems can find important details about a process by locating a specific store called
the PCB. Consequently, the PCB is the data structure that provides operating systems with a
process definition.

3. Consult a Linux manual and find out the actual content of a process descriptor in
Linux.
Ans. Process Descriptor: A Process Control Block that contains all the information about the state
of the process at any given time. The kernel stores the contents of multiple processer registers in
the process descriptor once the process has completed executing.

7. Explain why the context switch time is considered overhead. Give examples.

Ans. Context switching is the act of preserving and retrieving the state of a process to enable its
continuation at a later stage of execution. Context switching overhead is usually related to
multitasking, or running multiple programs concurrently on a single CPU. There will be overhead
in both time and memory since each time a time switch occurs, some data must first be obtained
and then stored in memory.

9. Is multiprogramming more useful in a multiuser system or a single-user system?


Discuss your arguments.
Ans. The capacity to execute several tasks simultaneously on a single machine is known as
multiprogramming. Using memory, this method puts instructions and data in a "queue" for the
CPU to process. This makes it possible for the CPU, which is normally an extremely costly
component, to be used and not sit idle for long. Stated differently, it enables a user to run
numerous programs on a single CPU at the same time.

10. A system has several processes that request I/O services in long time intervals
compared with very short CPU service. For example, the processes request services that
about 95 percent of the total service request time are I/O requests and only 5 percent are
CPU requests. What potential problems can this system exhibit? Explain.
Ans. Because the CPU scheduler must regularly choose which processes to execute on the CPU,
this adds to its workload. Furthermore, there will be numerous transitions between the operating
and waiting states. It results in an entirely overhead high context switch. Thus, CPU
underutilization results from CPU spending more time in context switching than in process
execution. Therefore, in order to maximize CPU use, the CPU scheduler selects a well-balanced
set of tasks.

You might also like