0% found this document useful (0 votes)
14 views6 pages

Lecture 6

The document discusses threads and threading concepts, including how threads allow multiple activities to run concurrently, are lighter than processes to manage, share memory within a process, and can improve performance when overlapping CPU and I/O operations.

Uploaded by

baglannurkasym6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views6 pages

Lecture 6

The document discusses threads and threading concepts, including how threads allow multiple activities to run concurrently, are lighter than processes to manage, share memory within a process, and can improve performance when overlapping CPU and I/O operations.

Uploaded by

baglannurkasym6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Test Variant 1

1. Why are threads used in programming?


 A) To decrease system security
 B) To allow multiple activities to run in quasi-parallel
 C) To consume more CPU resources
 Correct Answer: B
2. What is a significant advantage of threads over processes?
 A) Threads require more time to create and destroy
 B) Threads enhance system security
 C) Threads are lighter and faster to manage
 Correct Answer: C
3. In what scenario are threads particularly useful?
 A) When all activities are CPU bound
 B) When activities involve substantial I/O and computing
 C) When only one thread is used per application
 Correct Answer: B
4. What is a key benefit of using threads on a multi-CPU system?
 A) Increased complexity in management
 B) Reduction in available system resources
 C) Real parallelism of multiple threads
 Correct Answer: C
5. How do threads simplify the programming model?
 A) By allowing processes to share a single address space
 B) By eliminating the need for process creation
 C) By using more system resources
 Correct Answer: A
6. What would be a real-world application of using threads in a program?
 A) A word processor that handles user interaction and background tasks like
formatting
 B) A simple calculator program
 C) An application that only performs sequential tasks
 Correct Answer: A
7. What thread property allows them to be managed more easily than processes?
 A) Slower execution speed
 B) Sharing of the address space within the same process
 C) Increased system call usage
 Correct Answer: B
8. Why might threads be used in a word processor?
 A) To perform single-threaded tasks more slowly
 B) To handle user inputs, formatting, and periodic saving concurrently
 C) To decrease the application's performance
 Correct Answer: B
9. How does multithreading affect a program's performance when involving I/O
operations?
 A) It decreases performance by overlapping CPU and I/O operations
 B) It has no effect on performance
 C) It can speed up the application by overlapping CPU and I/O operations
 Correct Answer: C
10. What is the difference between threads and processes in terms of resource
sharing?
 A) Threads share resources like memory within the same process, unlike separate
processes
 B) Threads require more resources than processes
 C) There is no difference in resource sharing between threads and processes
 Correct Answer: A
11. What does the ability to run multiple threads in a single process enable?
 A) Decreased application reliability
 B) Quasi-parallel execution of tasks
 C) Single-threaded execution mode only
 Correct Answer: B
12. Why might a word processor use multiple threads?
 A) To reduce the functionality available to the user
 B) To handle different tasks like editing, auto-saving, and formatting
simultaneously
 C) To use all CPU resources ineffectively
 Correct Answer: B
13. How do threads improve user experience in interactive applications?
 A) By running all tasks sequentially
 B) By allowing background tasks to be performed without disrupting user
interaction
 C) By limiting the application to one task at a time
 Correct Answer: B
14. What is a major characteristic of threads within the same process?
 A) They operate independently with separate address spaces
 B) They cannot share any resources
 C) They share the same address space and can access the same data
 Correct Answer: C
15. How do threads handle system calls that block?
 A) By terminating the thread immediately
 B) One thread can block without stopping the execution of others
 C) All threads within the process are blocked
 Correct Answer: B
16. What advantage do threads provide in a multi-core processor environment?
 A) Each thread is confined to a single core.
 B) Threads can run truly in parallel on different cores.
 C) Threads prevent any core from being overused.
 Correct Answer: B
17. Why do threads have an advantage over processes in terms of resource
usage?
 A) They use more CPU resources.
 B) They are implemented without any resource overhead.
 C) They share resources like memory, which makes them lighter and faster
to manage.
 Correct Answer: C
18. What is one benefit of the thread model in a word processing application?
 A) It allows all operations to run on a single thread, simplifying the
program.
 B) Separate threads can handle user interaction, background reformatting,
and auto-saving simultaneously.
 C) It forces all threads to perform tasks sequentially, enhancing focus on a
single task.
 Correct Answer: B
19. How do threads within the same process share data?
 A) By using separate memory spaces.
 B) By using independent storage only.
 C) Through a shared address space and global variables.
 Correct Answer: C
20. What is the main reason threads are considered lightweight processes?
 A) They require extensive system resources to manage.
 B) They do not share the operating system resources like processes.
 C) They share most of the process resources, reducing the overhead of
resource management.
 Correct Answer: C

Test Variant 2

1. What allows threads to operate more independently within the same process?
 A) Separate address spaces
 B) Sharing the same set of open files, alarms, and signals
 C) Individual connections to external devices
 Correct Answer: B
2. Which programming model does threading simplify compared to traditional
single-threaded processes?
 A) Serial computing model
 B) Interrupt-driven programming model
 C) Multi-threaded programming model
 Correct Answer: B
3. What is the primary function of threads in a multi-threaded application?
 A) To reduce the application's functionality
 B) To allow several tasks to be executed simultaneously
 C) To increase the complexity of the application
 Correct Answer: B
4. How does thread creation compare to process creation in terms of system
resource usage?
 A) Thread creation uses more resources.
 B) Thread creation is typically faster and uses fewer resources.
 C) There is no difference in resource usage.
 Correct Answer: B
5. Why is threading advantageous in applications with both computing and I/O
tasks?
 A) It allows these tasks to run sequentially.
 B) It slows down the application by separating tasks.
 C) It allows overlapping of computing and I/O tasks, improving performance.
 Correct Answer: C
6. What kind of parallelism do threads in a single process provide?
 A) No parallelism
 B) Quasi-parallelism, as they appear to run simultaneously
 C) Complete isolation from each other
 Correct Answer: B
7. What is a significant risk when multiple threads manipulate the same data?
 A) There is no risk as threads are completely secure.
 B) Threads may interfere with each other, leading to data corruption.
 C) Threads can only read data, not write or modify it.
 Correct Answer: B
8. Which system resource do threads within the same process explicitly share?
 A) CPUs
 B) External devices
 C) Memory (address space)
 Correct Answer: C
9. What thread state is not immediately ready to run but waiting for an event to
occur?
 A) Running
 B) Blocked
 C) Terminated
 Correct Answer: B
10. How do threads enhance user experience in interactive applications?
 A) By running each task on a separate computer
 B) By allowing uninterrupted user interaction even during heavy processing tasks
 C) By focusing all system resources on a single task at a time
 Correct Answer: B
11. What is the role of the program counter in a thread's execution?
 A) It stores the thread's data.
 B) It indicates the next instruction to execute within the thread.
 C) It manages the thread's I/O operations.
 Correct Answer: B
12. What does it mean when a thread is in the 'ready' state?
 A) It is currently executing.
 B) It is prepared to run when given CPU time.
 C) It has finished execution and is about to close.
 Correct Answer: B
13. How do threads within the same process communicate with each other?
 A) Through a shared network.
 B) By using separate memory spaces.
 C) By directly accessing shared memory and variables.
 Correct Answer: C
14. Why would a word processor benefit from using multiple threads?
 A) To simplify its design by using a single-threaded approach.
 B) To manage user inputs, auto-saving, and intensive computations separately.
 C) To ensure that only one operation is performed at a time.
 Correct Answer: B
15. What common resource do threads within the same process not share?
 A) Program counters
 B) Memory
 C) CPU
 Correct Answer: A
16. Which IEEE standard is associated with threads?
 A) IEEE 802.11
 B) IEEE 1003.1c
 C) IEEE 1394
 Correct Answer: B
17. What is the advantage of threads sharing an address space?
 A) It limits the functionality of the application.
 B) It facilitates easier data sharing and communication among them.
 C) It makes the system more secure.
 Correct Answer: B
18. How does the system ensure that threads appear to run in parallel?
 A) By allocating each thread to a separate core
 B) Through rapid switching among threads
 C) By increasing the clock speed of the CPU
 Correct Answer: B
19. What kind of applications benefit most from multithreading?
 A) Applications that perform a single task repeatedly
 B) Applications that require multiple tasks to be performed, possibly overlapping
 C) Low-performance applications that do not handle I/O
 Correct Answer: B
20. How do threads differ from processes in terms of execution?
 A) Threads run independently on separate physical machines.
 B) Threads within the same process can execute concurrently on the same
machine.
 C) Threads do not allow concurrent execution.
 Correct Answer: B

You might also like