Symbols, Threads and Fibers Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is a Symbol in Ruby?

A

It is an identifier whose value is itself.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does a Symbol work internally in Ruby?

A

It is a pointer into Ruby symbol table, that is, Ruby’s internal list.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a thread?

A

It is a little self-contained program that runs inside a bigger program. Technically, the main program runs in a process and that process one or more threads are executed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

In what threat your application runs?

A

The main thread.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does the Mutex class do in Ruby?

A

It implements a simple semaphore that can be used to coordinate access to shared data from multiple concurrent threads.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a Fiber in Ruby?

A

Fibers are workers, they run code and keep track of their own process. In other words, fibers are concurrency mechanisms.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the difference between Threads and Fibers?

A

The start and stop of a Thread are controlled by the Operating System and with the Fibers, we need to tell them exactly when to start and when to stop.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How does the join method work with Threads?

A

The join method lets a Thread to share time with other Threads but it doesn’t synchronize them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly