Provi Mi
Provi Mi
1. Explain the difference between the processes and threads? List some of them.
A process is an instance of a program in execution, isolated from other processes, with its own
memory space. A thread, on the other hand, is a subset of a process. Threads within the same
process share the same memory space, allowing for more efficient communication between threads
than between processes.
Multithreading can help to make a program more responsive, especially for tasks waiting for external
resources or which need to perform slow I/O operations. It can also make a program more efficient
by allowing multiple operations to overlap in time.
4. Suppose we have a program that consists of two parts: Part A which takes up to 80% of
execution time. Part B which takes up to 20% of the remaining time. Part A can be parallelized,
but part B can not . If we run this program on a computer with 4 processors, how much speedup
can be expected to achieve by using Amdahl's Law ?
Amdahl’s law is used to find the maximum improvement possible by using parallel processing. If 80%
of the program can be parallelized, the fraction that is sequential is 20%. Therefore, the speedup is
1 / (0.20 + 0.80/4) = 2.5 times.
b) To run applications
d) The compiler
a) A program in execution
c) An input/output device
d) A type of memory
6. What is the difference between a process and a thread?
a) Concurrency involves executing multiple tasks at the same time, while parallelism
involves executing tasks sequentially.
b) Concurrency involves executing tasks sequentially, while parallelism involves executing tasks
at the same time.
a) Multiprogramming
b) Preemptive scheduling
c) Thread pooling
d) Multitasking
b) To prevent deadlock
14.When processes communicate with one another, this is often done through the use of
______________ .
a)Shared memory
b)Semaphores
c)Morse code
d)Shared files
a) To prevent deadlocks
c) Mutexes can be used to control access to multiple resources, while semaphores cannot
d) Semaphores can be used to control access to multiple resources, while mutexes cannot