Week 3 Mutual Exclusion

Week 3 Mutual Exclusion
3回閲覧 • 12問 • 11ヶ月前
  • ユーザ名非公開
  • 通報

    問題一覧

  • 1

    A section of code that accesses shared resources and must be executed by only one thread at a time is known as a:

    Critical section

  • 2

    In Peterson's Algorithm, which variable is used to decide whose turn it is to enter the critical section?

    turn variable

  • 3

    Which hardware instruction atomically sets a memory location to TRUE and returns its old value, often used for mutual exclusion?

    Test-and-Set

  • 4

    A semaphore is essentially a(n):

    Integer variable

  • 5

    Which semaphore operation decrements the semaphore value and blocks the process if the value becomes negative (or less than zero)?

    P(wait)

  • 6

    A binary semaphore is typically used for:

    Implementing mutual exclusion (acting as a lock)

  • 7

    What is the main advantage of using monitors over raw semaphores?

    Monitors automatically handle the mutual exclusion aspect when methods are called, reducing programming errors.

  • 8

    If a critical section is being protected by mutual exclusion, how many threads are allowed to execute within that critical section at any given time?

    One

  • 9

    What is the primary role of the synchronized keyword in Java?

    To guarantee that the method is executed by a single thread

  • 10

    What will happen if two threads try to acquire two locks in opposite order?

    Deadlock will occur

  • 11

    Semaphores are used to solve the problem of:

    both (1) and (2)

  • 12

    Mutual exclusion problem occurs

    Among processes that share resources

  • 1.1: Software life cycle

    1.1: Software life cycle

    ユーザ名非公開 · 17問 · 2年前

    1.1: Software life cycle

    1.1: Software life cycle

    17問 • 2年前
    ユーザ名非公開

    Intro to computing - Lecture 1

    Intro to computing - Lecture 1

    ユーザ名非公開 · 32問 · 2年前

    Intro to computing - Lecture 1

    Intro to computing - Lecture 1

    32問 • 2年前
    ユーザ名非公開

    Chapter 5

    Chapter 5

    ユーザ名非公開 · 7問 · 2年前

    Chapter 5

    Chapter 5

    7問 • 2年前
    ユーザ名非公開

    Intro to Comp - Lecture 4

    Intro to Comp - Lecture 4

    ユーザ名非公開 · 34問 · 2年前

    Intro to Comp - Lecture 4

    Intro to Comp - Lecture 4

    34問 • 2年前
    ユーザ名非公開

    Intro to comp - Lecture 3

    Intro to comp - Lecture 3

    ユーザ名非公開 · 24問 · 2年前

    Intro to comp - Lecture 3

    Intro to comp - Lecture 3

    24問 • 2年前
    ユーザ名非公開

    Intro to Comp - Lecture 2

    Intro to Comp - Lecture 2

    ユーザ名非公開 · 28問 · 2年前

    Intro to Comp - Lecture 2

    Intro to Comp - Lecture 2

    28問 • 2年前
    ユーザ名非公開

    Quiz 2

    Quiz 2

    ユーザ名非公開 · 7問 · 2年前

    Quiz 2

    Quiz 2

    7問 • 2年前
    ユーザ名非公開

    1.2: Software Engineering Methodologies

    1.2: Software Engineering Methodologies

    ユーザ名非公開 · 20問 · 2年前

    1.2: Software Engineering Methodologies

    1.2: Software Engineering Methodologies

    20問 • 2年前
    ユーザ名非公開

    2.2: Relational Model and ER Model

    2.2: Relational Model and ER Model

    ユーザ名非公開 · 19問 · 2年前

    2.2: Relational Model and ER Model

    2.2: Relational Model and ER Model

    19問 • 2年前
    ユーザ名非公開

    2.3: Converting ER Model to Relational model

    2.3: Converting ER Model to Relational model

    ユーザ名非公開 · 5問 · 2年前

    2.3: Converting ER Model to Relational model

    2.3: Converting ER Model to Relational model

    5問 • 2年前
    ユーザ名非公開

    Quiz 1

    Quiz 1

    ユーザ名非公開 · 8問 · 2年前

    Quiz 1

    Quiz 1

    8問 • 2年前
    ユーザ名非公開

    Week 2 Concurrency

    Week 2 Concurrency

    ユーザ名非公開 · 10問 · 11ヶ月前

    Week 2 Concurrency

    Week 2 Concurrency

    10問 • 11ヶ月前
    ユーザ名非公開

    Week 4 Synchronisation

    Week 4 Synchronisation

    ユーザ名非公開 · 10問 · 11ヶ月前

    Week 4 Synchronisation

    Week 4 Synchronisation

    10問 • 11ヶ月前
    ユーザ名非公開

    Week 5 Processes and scheduling

    Week 5 Processes and scheduling

    ユーザ名非公開 · 22問 · 11ヶ月前

    Week 5 Processes and scheduling

    Week 5 Processes and scheduling

    22問 • 11ヶ月前
    ユーザ名非公開

    Week 6 Interprocess Communication

    Week 6 Interprocess Communication

    ユーザ名非公開 · 22問 · 11ヶ月前

    Week 6 Interprocess Communication

    Week 6 Interprocess Communication

    22問 • 11ヶ月前
    ユーザ名非公開

    Week 7 File system

    Week 7 File system

    ユーザ名非公開 · 13問 · 11ヶ月前

    Week 7 File system

    Week 7 File system

    13問 • 11ヶ月前
    ユーザ名非公開

    Week 8 Virtual Memory

    Week 8 Virtual Memory

    ユーザ名非公開 · 22問 · 11ヶ月前

    Week 8 Virtual Memory

    Week 8 Virtual Memory

    22問 • 11ヶ月前
    ユーザ名非公開

    Week 9 Architectures

    Week 9 Architectures

    ユーザ名非公開 · 10問 · 11ヶ月前

    Week 9 Architectures

    Week 9 Architectures

    10問 • 11ヶ月前
    ユーザ名非公開

    BigO scenario qns

    BigO scenario qns

    ユーザ名非公開 · 8問 · 9ヶ月前

    BigO scenario qns

    BigO scenario qns

    8問 • 9ヶ月前
    ユーザ名非公開

    問題一覧

  • 1

    A section of code that accesses shared resources and must be executed by only one thread at a time is known as a:

    Critical section

  • 2

    In Peterson's Algorithm, which variable is used to decide whose turn it is to enter the critical section?

    turn variable

  • 3

    Which hardware instruction atomically sets a memory location to TRUE and returns its old value, often used for mutual exclusion?

    Test-and-Set

  • 4

    A semaphore is essentially a(n):

    Integer variable

  • 5

    Which semaphore operation decrements the semaphore value and blocks the process if the value becomes negative (or less than zero)?

    P(wait)

  • 6

    A binary semaphore is typically used for:

    Implementing mutual exclusion (acting as a lock)

  • 7

    What is the main advantage of using monitors over raw semaphores?

    Monitors automatically handle the mutual exclusion aspect when methods are called, reducing programming errors.

  • 8

    If a critical section is being protected by mutual exclusion, how many threads are allowed to execute within that critical section at any given time?

    One

  • 9

    What is the primary role of the synchronized keyword in Java?

    To guarantee that the method is executed by a single thread

  • 10

    What will happen if two threads try to acquire two locks in opposite order?

    Deadlock will occur

  • 11

    Semaphores are used to solve the problem of:

    both (1) and (2)

  • 12

    Mutual exclusion problem occurs

    Among processes that share resources