Q1.Why do we want to use multiple threads in an application?
- The more threads in one application, the faster the application will be.
- By using multiple threads we can execute multiple related tasks simultaneously, making the application more responsive. And executing multiple tasks in parallel may achieve higher performance.
- Having multiple threads is always a better software design.
- Creating more threads in one process, is always better than creating a new application.
Q2. Multiple threads in a single process share:
- The stack , heap , instruction pointer, Code, The process's open files
- Only application code
- The heap, Code, The process's open files, The process's meta data
- Only heap
Q3. How does the Operating System design what thread to schedule?
- The Operating System maintains a dynamic priority for each thread to prioritize interactive threads and to avoid starvation for any particular thread in the system.
- The Operating System is going to choose the interactive threads ahead of any other threads at all times to make the users happy.
- The Operating System will always pick the shortest job at any given moment.
- The Operating System will simply pick a random thread to execute, which on average will be fair to everybody.
Q1 - 2
Q2 - 3
Q3 - 1
No comments:
Post a Comment