[Betrieb System] - Prozess & Thread

Notizen auf Vorlesung [Betrieb System]

Adressraum:


Prozess A
 ________
|Kern    |
----------
|Stack   |   <---- Stack Pointer
|...     | 
|...     |
|        |
|--------|
|BSS     |
|--------|
|DATA    |
|--------|
|Text    |
|--------|

Stack-Segment: Kellerspeicher

  • Funktionsparameter und lokale Variablen
  • Ruecksprung Adresse

Daten-Segment: globale Daten

  • Data: intialisierte Daten
  • BSS: “block started by symbol” per Konvention mit 0 intialisiert erweiterbar durch systemanruf

Textsegment: Maschinencode

  • nur lesbar, ausfuehrbar
  • erste Seite frei zum erkennen nicht-intialisiert Pointer

Thread-Zustände

  1. aktiv: Thread wird gerade auf der CPU ausgeführt, Pro CPU ist zu jedem Zeitpunkt maximal ein Thread aktiv.

  2. blockiert: Warten auf ein Ereignis (z.B. Botschaft, Freigabe eines Betriebsmittels) um weiterarbeiten zu können

  3. bereit: nicht blockiert, aber momentan nicht aktiv. Die bereit-Menge enthält alle Threads, die ummitttelbar aktic werden können

_________        _______          __________
BLOCKIERT| <-----|Aktiv|  <------ | Bereit |
_________|       |_____|  ------> |________|
    |                                 ^
    |_________________________________|

RANDBEDINGUNGEN:

  • Zu jeder Zeit ist höchstens eine Thread pro CPU aktiv
  • eine aktiber Thread ist zu jedem Zeitpunkt genau einer CPU zugeordnet.
  • nur die bereiten Threads erhalten CPU (werden aktiv)
  • Fairness: jeder THread erhält angemessenen Antel CPU-Zeit, kein Thread darf CPU für sich allein beanspruchen.
  • Wohlverhalten von Threads darf bei Implementierung von Threads keine Voraussetzung sein. z.B. while (true) {} darf nicht dazu führen, dass andere Threads nie wieder “drankommen”

Kooperative vs. präemtive Umschaltung

Cooperative vs Preemtive

Cooperative Preemtive
tasks manage their lifecycle scheduler have control over tasks
Task decides when to yield control back to scheduler Scheduler can interrupt tasks
Assign task to worker that is free Assign a time slice for the task
switch task when it yields control switch task when it yields control or its time is up
can results in hang up won’t hang up for a haning task
Scheduler dont’s needs to care about tasks’ state Scheduler needs to maintain a table of tasks’ state i.e. registers, stack pointer
Low switching overhead High switching overhead
edited 20.04.2024
created 10.11.2020
EOF

[+] click to leave a comment [+]
the comment system on this blog works via email. The button
below will generate a mailto: link based on this page's url 
and invoke your email client - please edit the comment there!

[optional] even better, encrypt the email with my public key

- don't modify the subject field
- specify a nickname, otherwise your comment will be shown as   
  anonymous
- your email address will not be disclosed
- you agree that the comment is to be made public.
- to take down a comment, send the request via email.

>> SEND COMMENT <<




2024-05-04 ♦ Live A/V Show in Rochester via Paloma Kop ♦ RSS Feed April 21, 2024
Live audiovisual show in Rochester, NY... Read more↗

2024-04-21 via mrshll.com April 21, 2024
Well, it's real now. We are moving to Nashville. I came to Boston in 2009 to study computer science and stayed for the career opportunities, loud and then quiet music scene (where I met Alejandra), and the wonderful friends we've made over the ye…

Āyen, Pōm, and ITGBTW Remixes via Helvetica Blanc April 19, 2024
The newest Wormsong entry, Āyen, marks the beginning of a little interactivity in the narrative. After each entry goes live, I'll post a choice on Patreon. All patrons can vote, and their choices will allow us to explore the Realms together! I don'…

Generated by openring from webring