lectures.alex.balgavy.eu

Lecture notes from university.
git clone git://git.alex.balgavy.eu/lectures.alex.balgavy.eu.git
Log | Files | Refs | Submodules

Multithreading.html (2176B)


      1 <?xml version="1.0" encoding="UTF-8"?>
      2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      3 <html><head><link rel="stylesheet" href="sitewide.css" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta name="exporter-version" content="Evernote Mac 6.13.1 (455785)"/><meta name="altitude" content="-0.1619278639554977"/><meta name="author" content="Alex Balgavy"/><meta name="created" content="2017-12-19 6:15:24 PM +0000"/><meta name="latitude" content="52.37356806716691"/><meta name="longitude" content="4.836201981401016"/><meta name="source" content="desktop.mac"/><meta name="updated" content="2017-12-20 8:08:24 PM +0000"/><title>Multithreading</title></head><body><div>each process in the operating system has a thread</div><div>thread — thread of control whose state consists of contents of program counter and other processor registers (a specific process)</div><div>two or more threads can run on different processors, executing either same part of program on different data, or different parts of a program, or different programs</div><div><br/></div><div>multitasking two or more programs on same processor</div><div>time slicing — OS selects process that’s not blocked and lets it run for a short period of time</div><div>context switching — OS selects a different process at the end of the time slice</div><div>timer interrupt — interrupt-service routine to switch from one process to another</div><div><br/></div><div>hardware multithreading:</div><div><ul><li>processor has several identical sets of registers, each for a different thread</li><li>this includes multiple program counters</li><li>makes context switching simple &amp; fast, just change a hardware pointer to use a different set of registers, in one clock cycle</li></ul><div><br/></div></div><div>coarse-grained multithreading: on a cache miss during Load/Store, switch to a different thread and continue fetching/executing other instructions</div><div>fine-grained/interleaved multithreading: switch threads after every instruction is fetched, increasing processor throughput</div></body></html>