Operating systems basics (processes, threads)

Computer Science · Computer architecture & systems

Question 1 of 10

0

    Which state describes a process that is waiting for an input/output operation to finish?

    Stuck? Read the explanation

    Unlocks at a streak of 5 correct answers in a row.

    Print a free worksheet (PDF)

    Embed this practice on your site or class page

    Paste this HTML into your page. Students practise right there; it is free and needs no account.

    Operating systems basics (processes, threads) explained

    An operating system (OS) is the software that manages a computer's hardware and gives programs a controlled way to use it. Windows, macOS, Android and Linux are examples. Two of its most important jobs are managing processes and threads.

    A process is a program that is running. The OS gives each process its own memory, so one process cannot read or damage another's memory by accident. A thread is a separate path of execution inside a process. The threads of one process share its memory, which makes communication between them quick, but they must take care not to change the same data at the same time.

    The scheduler decides which process or thread gets the CPU at each moment. It switches between them rapidly, saving the state of one and loading the state of the next, which is called a context switch. A computer with several cores can run several threads at exactly the same time. A common mistake is to think a computer with one core cannot run several programs. It can, by switching quickly between them, so that each appears to run at once.

    Worked example

    Consider a web browser with three tabs.

    1. The browser has a main process for the window, and each tab can be given its own process.
    2. Inside one tab, one thread downloads images while a second thread responds to scrolling.
    3. Those two threads share the tab's memory, so they must coordinate when they update the same data.
    4. If one tab's process crashes, the processes for the other tabs can keep running.

    What you will practise

    103 multiple-choice questions (Easy, Medium, Hard). Each answer is followed by an explanation.

    Example questions

    • The operating system manages:
    • A process is:
    • Threads within a process share:
    • The scheduler decides:
    • Context switching:
    • The smallest unit of execution that the OS scheduler normally schedules is usually:
    • Each process has its own:
    • A program stored on disk that is not currently running is called:

    …and 95 more.