Concurrency Flashcards
1
Q
Synchronous fs asynchronous
A
Synchronous = blocking
Asyn = non-blocking, code executes immediately
2
Q
Why use async?
A
Better user experience
3
Q
What is a thread?
A
A path of execution of a group of statements
4
Q
What is multithreading?
A
Like hafing another cpu to execute code
5
Q
Name 3 multithreading problems
A
Deadlock
Race conditions
Starfation
6
Q
What are Lambdas?
A
Anon functions
Like arrow functions
7
Q
What is CompletableFutures used for?
A
Used to multithread
8
Q
What should you use completable futures?
A
I/O bound operations: Db calls, API calls
Parallel processing: Large datasets
Responsife UI
9
Q
When shouldn’t you use completable futures?
A
Short lifed operations
Operations that inherently block
When oferusing threads
10
Q
A