Lecture 16 - Multitasking Flashcards

1
Q

What is multitasking?

A

Multitasking means running several processes (or tasks) in parallel.
This is a more general method than background timer routines.

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

What is multithreading?

A
  • Multithreading is a simpler and faster version of Multitasking, which switches between parallel threads, keeping all of them in memory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is sequential hardware?

A
  • If we only have sequential hardware, the operating system takes turns in executing each process (time slicing)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the task definition?

A

Task, Process, Thread
* Similar to function/ procedure; no parameters, no return value
* Often contains (endless) loop
* Can read its own Task-ID
* Can terminate itself or others

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

What is scheduling?

A

Scheduler transfers control between tasks using time slices

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

What is he task model?

A

Refer to slides for diagrams

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

What is Pthreads?

A
  • Extension to standard Unix fork() and join()
  • Previously many different implementations
  • Standard IEEE POSIX 1003.1c standard (1995)
  • Performance:
    – Much faster than fork() (about 10x)
    – Much faster than MPI, PVM

====
▪ POSIX Threads = Pthreads
▪ A thread is best described as a “procedure that runs independently” from the main program.
▪ In Linux, a thread:
▪ Exists within a process and uses the process resources
▪ Has its own independent flow of control
▪ Terminates if the parent process terminates
▪ Because threads within the same process share resources:
▪ Changes made by one thread to shared system resources (such as closing a file) will be seen by all other threads.
▪ Two pointers having the same value point to the same data.
▪ Reading and writing to the same memory locations is possible, and therefore requires explicit synchronization by the programmer.
▪ Each thread requires a separate data stack

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

What are the Pthread functions

A

Refer to slides for examples and diagrams

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

What is synchronisation?

A

Problem:
* There is no way of telling when the time slice is up and the next task gets activated
* Task switch might come at a bad time
e.g. here in middle of printout
Solution:
* Task synchronization
– There are several methods, but here we only look at simple “mutual exclusive” locks = mutex
– Operations init, lock and unlock

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

What are the functions for Pthreads: Mutex Functions

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

What are the most important design issues for embedded systems?

A
  • Small
  • Cheap
  • Reliable
How well did you know this?
1
Not at all
2
3
4
5
Perfectly