adp revision concurrency

0.0(0)
studied byStudied by 0 people
full-widthCall with Kai
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/25

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

26 Terms

1
New cards

What is concurrency?

Concurrency is the ability of a system to have multiple tasks in progress at the same time.

2
New cards

Why do concurrency bugs appear only occasionally or on some platforms?

Because thread scheduling and CPU usage vary across platforms and bugs are dependent on timing and conditions.

3
New cards

What is a thread?

A thread is the smallest unit of execution that an operating system can schedule.

4
New cards

How many threads can a process contain?

A process can contain multiple threads that run concurrently

5
New cards

What is concurrency in the context of server implementations?

Handling multiple client requests at the same time to improve performance and responsiveness.

6
New cards

What is a multithreaded server?

A server that has a dedicated thread for each request

7
New cards

What are the advantages of multithreaded servers on physical hardware?

True parallelism on multiple cores and efficient CPU usage.

8
New cards

What are the disadvantages of multithreaded servers on virtualized platforms?

Not enough CPU cores, forcing threads to share them, resulting in delays and more demand for resources in thread creation

9
New cards

How does Node.js implement concurrency?

Using a dispatch queue to handle many requests efficiently

10
New cards

What are virtual threads and why are they important?

Virtual threads are lightweight threads similar to normal threads however use fewer resources so you can run lots of tasks without slowing things down.

11
New cards

In a virtualized environment, what is more important than raw thread count?

The ability to scale with multiple instances and efficient resource use per instance.

12
New cards

What is parallelism?

Where multiple threads execute independently

13
New cards

What is the negative impact of a deadock?

System stagnation, resource waste, downgraded performance

14
New cards

What can be used to prevent race conditions in Java?

synchronized keyword

15
New cards

What can be used to prevent deadlocks?

timeout-based locks

16
New cards

What keyword can ensure memory consistency for a variable without full synchronisation?

volatile

17
New cards

What does each CPU have it’s own of?

Cache

18
New cards

Which server model is better suited to physical hardware and why?

Multithreaded servers, because physical machines have multiple CPU cores that support parallelism, making thread creation and execution efficient.

19
New cards

Which server model works best on virtual machines (cloud platforms)?

Single-threaded servers using dispatch queues, because they use less CPU and scale easily

20
New cards

What is the trade-off between multithreaded and single-threaded server models?

Multithreading offers real concurrency and performance on physical servers, while single-threaded models are more efficient and scalable in virtual/cloud platforms.

21
New cards

What does the synchronised keyword do?

Ensures only one thread can access a block of code or object at a time.

22
New cards

What does the volatile keyword do?

Ensures memory consistency by ensuring all threads see the most recent value of a variable

23
New cards

What does a timeout-based lock do and how does it help prevent deadlocks?

It lets a thread try to get access but gives up if it takes too long. This stops threads from getting stuck and avoids deadlocks.

24
New cards

What’s an example of a deadlock?

Thread A holds Resource 1 and waits for Resource 2, while Thread B holds Resource 2 and waits for Resource 1

25
New cards

How does concurrency improve system efficiency?

It let’s the CPU do useful work while tasks are waiting instead of sitting idle.

26
New cards

How many conditions does it take for a deadlock to happen?

4