Quiz: Operating systems processes and threads

This quiz set covers fundamental concepts of operating systems, processes, and threads, designed for college-level computer science students.

Liam2007·40 flashcards·40 questions
collegecomputer_sciencecomputer_basics
0
Known
1 / 40
0
Learning
Front

What is an operating system?

Tap to flip
Back

An operating system (OS) is software that manages computer hardware and software resources, providing services for computer programs.

Tap to flip
Got it
Still learning

Quiz(40 questions)

Question 1 of 40

1. What is the primary purpose of a process?

Terms in this Study Set(40)

Operating System Basics(12)

What is an operating system?

An operating system (OS) is software that manages computer hardware and software resources, providing services for computer programs.

List key functions of an operating system.

- Process management - Memory management - File system management - Device management - User interface

True or False: The OS is the only software on a computer.

False. The OS is essential, but other software applications also run on the computer.

Define user interface in the context of an OS.

A user interface (UI) allows users to interact with the operating system and applications via graphical or command-line interfaces.

Compare GUI and CLI.

GUI (Graphical User Interface): User-friendly, visual elements. CLI (Command Line Interface): Text-based, requires commands.

The OS is responsible for _____ management.

memory

How does an OS manage processes?

The OS allocates CPU time, creates and terminates processes, and ensures efficient process scheduling to maximize CPU usage.

What role does the OS play in hardware management?

The OS acts as an intermediary between applications and hardware, managing device drivers for communication and resource allocation.

Cause → Effect: OS failure occurs.

Resulting in application crashes and potential data loss.

What is file system management?

File system management organizes and keeps track of files on storage devices, handling operations like creation, deletion, and access control.

True or False: An OS is not necessary for a computer to function.

False. An OS is crucial for managing resources and running applications effectively.

Give an example of an OS.

Windows, macOS, Linux are common operating systems.

Processes and Scheduling(14)

What is a process?

A process is an instance of a program in execution, consisting of program code, current activity, and a set of resources.

List the states of a process.

- New - Ready - Running - Waiting - Terminated

True or False: A process can be in multiple states at once.

False - A process can only be in one state at a time.

What does the ready state mean?

The process is loaded into memory and waiting for CPU time to execute.

What transitions a process from running to waiting?

A process moves to the waiting state when it requires resources or I/O operations that are not immediately available.

Fill in the blank: A __________ is a queue of processes waiting to be assigned to a CPU.

Ready queue

Compare preemptive and non-preemptive scheduling.

Preemptive: CPU can be taken away from a running process. Non-preemptive: Process runs until it voluntarily yields the CPU.

Define scheduling.

Scheduling is the method by which processes are assigned to run on the CPU, determining their order and allocation of resources.

What factors influence process scheduling?

- CPU utilization - Throughput - Turnaround time - Waiting time - Response time

What is a context switch?

A context switch is the mechanism that saves and restores the state of a CPU so that multiple processes can share a single CPU resource.

True or False: Context switching is always efficient.

False - Context switching involves overhead and can reduce CPU efficiency due to time spent saving and loading states.

What is turnaround time?

Turnaround time is the total time taken from submission of a process to its completion, including waiting and execution times.

Cause → Effect: What happens when a process terminates?

The operating system releases its allocated resources and returns its exit status to the parent process.

What role does the scheduler play?

The scheduler determines which process runs at any given time, maximizing CPU utilization and system responsiveness.

Threads and Concurrency(14)

What is a thread?

A thread is a lightweight process that can execute independently. It shares resources with other threads in the same process, enhancing efficiency and performance.

True or False: Threads do not share memory.

False. Threads share the same memory space, which allows for faster communication and data exchange.

What is concurrency?

Concurrency is the ability of an operating system to provide multiple threads of execution within a single process. It doesn't mean they execute simultaneously but can progress independently.

List two advantages of using threads.

- Improved performance - Better resource sharing

What is a thread pool?

A thread pool is a collection of reusable threads that are used to perform tasks. It manages the number of concurrent threads and improves resource utilization.

Fill in the blank: A _________ is the smallest sequence of programmed instructions that can be managed independently by a scheduler.

thread

Cause → Effect: Creating multiple threads

Cause: Creating multiple threads leads to a more responsive application. Effect: It can also increase complexity and potential for race conditions.

What is a race condition?

A race condition occurs when two or more threads access shared data and try to change it at the same time, leading to unpredictable outcomes.

Compare user threads and kernel threads.

User threads are managed by user-level libraries; kernel threads are managed by the operating system. Kernel threads can take advantage of multiple processors.

What does context switching involve?

Context switching involves saving the state of a currently running thread and loading the state of the next thread to be executed, causing overhead.

True or False: Threads can run on different processors simultaneously.

True. When multiple threads are scheduled on a multi-core processor, they can execute simultaneously, enhancing performance.

What is a critical section?

A critical section is a segment of code that accesses shared resources and must not be executed by more than one thread at a time to prevent data inconsistency.

Give an example of thread synchronization.

An example is using a mutex lock to control access to a shared variable, ensuring only one thread modifies it at a time.

What is deadlock?

Deadlock is a situation where two or more threads are unable to proceed because each is waiting for the other to release resources.

Questions in this Study Set(40)

1. What is the primary purpose of a process?

A.To execute program instructions
B.To manage memory allocation
C.To handle input/output operations
D.To optimize CPU performance

2. What does an operating system primarily manage?

A.Hardware and software resources
B.Only user applications
C.Network connections
D.Database systems

3. What is the primary purpose of using threads in a program?

A.To improve performance and responsiveness
B.To reduce memory usage
C.To eliminate the need for synchronization
D.To increase the complexity of the program

4. Which of the following is NOT a state of a process?

A.New
B.Waiting
C.Terminated
D.Suspended

5. Which function involves keeping track of running applications?

A.Process management
B.Memory management
C.File management
D.Security management

6. Which of the following best defines concurrency?

A.The ability to run multiple processes at the same time
B.The ability to manage multiple threads within a single process
C.The sequential execution of threads
D.The allocation of CPU time to different processes

7. What does it mean for a process to be in the 'running' state?

A.It is waiting for user input.
B.It is currently being executed by the CPU.
C.It has completed execution.
D.It is in the queue for CPU allocation.

8. True or False: An operating system can run without any applications installed.

A.True
B.False
C.Depends on the OS
D.Only on mobile devices

9. Which of the following is NOT an advantage of using threads?

A.Reduced context switching overhead
B.Increased responsiveness
C.Simplified program design
D.Better resource sharing

10. What happens when a process needs I/O operations?

A.It remains in the running state.
B.It is moved to the terminated state.
C.It transitions to the waiting state.
D.It immediately ends execution.

11. What is a major characteristic of a graphical user interface (GUI)?

A.Text-based commands
B.Visual elements for interaction
C.Limitations in user accessibility
D.Complex navigation

12. What function does a thread pool serve?

A.It creates new threads for every task
B.It provides a collection of reusable threads for tasks
C.It limits the number of threads in a program to one
D.It executes tasks without threading

13. In a preemptive scheduling system, what can happen to a running process?

A.It can be paused to allow another process to run.
B.It must complete before the next process can start.
C.It cannot be interrupted once it starts.
D.It is terminated immediately.

14. Which of the following statements is NOT true about memory management?

A.It allocates memory space for processes
B.It prevents memory leaks
C.It maintains the file system
D.It tracks memory usage

15. In the context of threading, what is a race condition?

A.A method of synchronizing threads
B.A situation where threads compete for resources leading to inconsistent results
C.A mechanism to prevent deadlock
D.A scenario where threads run sequentially

16. Which of the following best describes 'throughput'?

A.The total time taken for a process to complete.
B.The number of processes completed in a given time frame.
C.The time taken for a process to start and finish.
D.The average wait time for processes.

17. What is the effect of an OS failure?

A.Enhanced system performance
B.Application crashes and data loss
C.Improved security features
D.Faster processing speed

18. Which type of thread is managed by the operating system?

A.User thread
B.Kernel thread
C.Java thread
D.Lightweight thread

19. What is the result of a context switch?

A.The CPU is turned off.
B.The state of a process is saved and restored.
C.A process is terminated.
D.A new program is loaded into memory.

20. How does an OS facilitate process scheduling?

A.By allocating memory space
B.By managing CPU time allocation
C.Through file management
D.By controlling user permissions

21. What is context switching?

A.The process of launching a new thread
B.Switching between user and kernel mode
C.Saving and loading thread states during execution
D.The execution of threads on different processors

22. Which of the following does NOT affect scheduling decisions?

A.CPU utilization
B.Process priority
C.User preferences
D.Response time

23. Which of the following is NOT a function of an operating system?

A.User interface management
B.Device management
C.Web browsing
D.File system management

24. True or False: A critical section must only be accessed by one thread at a time.

A.True
B.False
C.Only if it is synchronized
D.Only in kernel threads

25. What is 'turnaround time'?

A.Time taken for a process to move to the ready state.
B.Total time from submission to completion of a process.
C.Time spent in the running state only.
D.Time taken for a context switch.

26. What role does the OS play in hardware communication?

A.Directly executes hardware instructions
B.Acts as an intermediary between hardware and software
C.Operates hardware independently
D.Only manages input devices

27. What does synchronization help prevent?

A.Memory leaks
B.Race conditions
C.Thread starvation
D.Deadlocks

28. In a non-preemptive scheduling system, what happens once a process starts executing?

A.It can be interrupted at any time.
B.It runs until it voluntarily yields the CPU.
C.It can be terminated by the OS.
D.It is immediately placed in the waiting state.

29. What is a key aspect of file system management?

A.Organizing files on storage devices
B.Deciding user access levels
C.Running applications
D.Maintaining network connections

30. What happens during a deadlock?

A.Threads complete their tasks successfully
B.Threads are unable to proceed due to waiting on each other
C.Threads execute concurrently without issues
D.Threads are terminated by the operating system

31. What determines the order in which processes run on the CPU?

A.Operating system version
B.Process state
C.Scheduling algorithm
D.User settings

32. Which of the following is an example of an operating system?

A.Microsoft Excel
B.Adobe Photoshop
C.Linux
D.Google Chrome

33. Which of the following is an example of thread synchronization?

A.Using a mutex lock to control access to shared data
B.Creating a thread for every user request
C.Running threads sequentially to avoid conflicts
D.Killing threads that take too long to execute

34. What does the 'ready queue' represent?

A.Processes that are terminated.
B.Processes waiting for I/O operations.
C.Processes waiting to be assigned to the CPU.
D.Processes currently running on the CPU.

35. True or False: The OS manages user permissions and security features.

A.True
B.False
C.Only for networked systems
D.Only for mobile devices

36. Which operation is involved in creating a new thread?

A.Forking a process
B.Context switching
C.Loading a thread state
D.Allocating memory

37. Once a process terminates, what is the typical next step for the operating system?

A.It allocates new resources.
B.It returns the exit status to the parent process.
C.It immediately starts another process.
D.It freezes the system.

38. True or False: Threads can execute on multiple processors at the same time.

A.True
B.False
C.Only in single-core processors
D.Only when using kernel threads

39. Which of the following best describes a context switch?

A.It saves and restores the state of a CPU for multiple processes.
B.It is the time taken for a process to complete execution.
C.It eliminates the need for I/O operations.
D.It is the state when a process is waiting for resources.

40. Which of the following scenarios best illustrates a race condition?

A.Two threads simultaneously attempt to update a shared bank account balance without proper locking.
B.A single thread reads data from a file and processes it sequentially.
C.Two threads independently download files from the internet without affecting each other.
D.A thread queues a task to another thread pool for execution.

Related Study Sets

Create Your Own Study Set

Upload a PDF, paste your notes, or describe a topic – AI generates flashcards, quizzes and more in seconds.