Part 2
Part 2
BSIT – 301
Platform technology (OS)
lOMoARcPSD|46679252
1. Search for relative studies and/or literature regarding the process and thread concepts of the
following operating systems:
A. Linux OS
B. Android OS
2. Then, provide or answer the following for each operating system (Linux and Android):
• Provide a diagram showing the process and thread construct of the operating system. (5
points)
• Briefly explain the diagram that you have provided. (5 points)
• How does the operating system support or implement multithreading? (5 points)
• Is it possible to increase the number of threads within processes without affecting the
average response time of this operating system? Why or why not? (5 points)
• What are the possible effects of multithreading in the central processing unit (CPU)
utilization of this operating system? Rationalize your answers. (5 points)
• Properly cite all your references (i.e., books, articles, dissertations, websites, etc.). (5
points)
Linux OS
lOMoARcPSD|46679252
Fork () is used to create the thread from the process and it implements the parent child
relationship between the process and the thread. The thread uses the resources used by the
process. The communication is made with signal, which has the messages. The following states
are present in the process and threads execution:
1. Running: currently executing process/threads. It includes two states which is Ready and
Executing.
2. Interruptible: suspends the execution until certain condition becomes true.
3. Uninterruptible: same as the interruptible but here it does not respond for the signals.
4. Stopped: the termination of the execution
5. Zombie: process execution is completed, but not the child process. Because the process has
not done the signal to notify about the child process.
Linux has a unique implementation of threads. To the Linux kernel, there is no concept of a
thread. Linux implements all threads as standard processes. The Linux kernel does not provide
any special scheduling semantics or data structures to represent threads. Instead, a thread is
merely a process that shares certain resources with other processes.
• Multiple threads that share the same process is created by using the fork() semantics.
• A set of rules is determined to fix when and how each thread should execute.
• The scheduling of the process and threads should be done. It is done by considering
process pre-emption, time sharing, and ranking the process/threads according to their
priority.
• Priorities can be static or dynamic.
• Highest priority will be executed first.
The increase in number of threads within the process does not affect the response time because
there is no maximum limit for thread creation for a process. Also, the response time increases
when there are a greater number of threads. The requests will be processed by a thread which is
idle at that time and gives quick reply.
In the address space of its hosting process, it has a set of CPU registers and stack state. In a
singleprocessor system, threading is helpful because it allows the principal execution thread to
respond to human input while supporting threads do long-running activities in the background
that do not require user participation. When considering how multithreading works, it's vital to
distinguish between parallel and concurrent processing. Parallel multiprocessing refers to the
system's ability to handle many threads at the same time. Only one thread will be addressed at a
time in concurrent processing, but the system will save time by switching between two or more
threads fast.
• The CPU time divided into epochs
• Epochs is the time runnable between all the threads.
• Every thread is given a certain time to execute. I.e., quantum period.
• When quantum period is expired, the CPU invocates or blocks the process/threads and
sets another priority and time to execute and quantum period.
lOMoARcPSD|46679252
https://webeduclick.com/linux-process-and-thread-management/
https://www.informit.com/articles/article.aspx?p=370047&seqNum=3
Android OS
When an Android application is first launched, the runtime system automatically establishes a
single thread in which all of the program's components execute. The main thread is the name
given to this thread (UI Thread). The main thread's major responsibility is to manage the user
interface in terms of event processing and interaction with views. By default, any extra
components that are launched within the program will execute on the main thread as well.
Any component in an application that uses the main thread to conduct a time-consuming activity
will appear to lock up the whole app until the job is done. The user will usually get an
"Application is unresponsive" (ANR) warning from the operating system. This is clearly not the
expected behavior for any software. This may be prevented in such a case by running the job on
a separate thread, enabling the main thread to continue working on other tasks without
interruption.
• Threads in android are categorized into two: within activity fragment and without activity
fragment.
• Threads within are: asynchronized task and loaders.
• Threads without are: services from other sources and intent services.
• There are main thread and background thread to handle the activities of the android.
• Main thread is responsible for all the interface related activities.
• Back ground threads are responsible for the activities happening in the back end for
providing the services.
lOMoARcPSD|46679252
While the JVM will optimize multithreading performance automatically, the user's actual speed
will be determined by his device's hardware. The software might operate on devices with a single
processing core or many processing cores due to Android's mobility. Android can use several
CPU cores for multithreading, but it is handled by the kernel and JVM, not by the developer. The
program's fundamental performance will be improved by an internal multithreading architecture,
but the device on which it runs will decide its speed.
• Multi thread can be implemented for android.
• Implement the Runnable interface
Runnable interface.new Thread ( new Runnable()
{
Public void run()
{
While (true)
{
//code//
}}}
The increase in number of threads within the process does not affect the response time since there
are no maximum limit for thread creation for a process. Also, the response time increases when
there are more number of threads. The requests will be processed by a thread which is idle at that
time and gives quick reply.
https://sites.google.com/site/puneetverma24android/process-and-thread/android-thread
https://sites.google.com/site/puneetverma24android/process-and-thread
https://smallbusiness.chron.com/four-ways-operating-system-controls-
hardwarecomputer75028.html