📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    Question

    A critical section in multithreaded programming is a

    code segment that:
    A Can be executed by multiple threads simultaneously without any issues. Correct Answer Incorrect Answer
    B Must be executed by only one thread at a time to prevent race conditions. Correct Answer Incorrect Answer
    C Contains only I/O operations and no shared data. Correct Answer Incorrect Answer
    D Is protected by a semaphore with an initial value greater than 1. Correct Answer Incorrect Answer
    E Is always executed in kernel mode. Correct Answer Incorrect Answer

    Solution

    A critical section is a segment of code where shared resources are accessed. To maintain data consistency and prevent race conditions, only one thread should be allowed to execute its critical section at any given time.

    Practice Next
    ask-question