Threads vs. Events Capriccio A Thread Model 5204

Threads vs. Events Capriccio  A Thread Model 5204

Threads vs. Events Capriccio A Thread Model 5204 Operating Systems Threads vs. Events Two approaches Capriccio Each service request bound to an independent thread Each thread executes all stages of the computation Seda Each thread bound to one stage of the computation Each service request proceeds through successive stages CS 5204 Operating Systems 2

Threads vs. Events Capriccio Philosophy Techniques Thread model is useful Improve implementation to remove barriers to scalability User-level threads Linked stack management Resource aware scheduling Tools Compiler-analysis Run-time monitoring CS 5204 Operating Systems

3 Threads vs. Events Capriccio user level threads yield Capriccio kernel User-level threading with fast context switch Cooperative scheduling (via yielding) Thread management costs independent of number of threads (except for sleep queue) Capriccio polling scheduler asynch I/O scheduler kernel

Intercepts and converts blocking I/O into asynchronous I/O Does polling to determine I/O completion CS 5204 Operating Systems 4 Threads vs. Events Compiler Analysis - Checkpoints Call graph each node is a procedure annotated with maximum stack size needed to execute that procedure; each edge represents a call Maximum stack size for thread executing call graph cannot be determined statically Insert checkpoints to allocate additional stack space (chunk) dynamically Recursion (cycles in graph) Sub-optimal allocation (different paths may require substantially different stack sizes) On entry (e.g., CO)

On each back-edge (e.g. C1) On each edge where the needed (maximum) stack space to reach a leaf node or the next checkpoints exceeds a given limit (MaxPath) (e.g., C2 and C3 if limit is 1KB) Checkpoint code added by source-source translation CS 5204 Operating Systems 5 Threads vs. Events Linked Stacks main A B Thread stack is collection of non-contiguous blocks (chunks) MinChunk: smallest stack block allocated Stack blocks linked by saving stack pointer for old block in field of new block; frame pointer remains unchanged Two kinds of wasted memory

Two controlling parameters C Internal (within a block) (yellow) External (in last block) (blue) MaxPath: tradeoff between amount of instrumentation and run-time overhead vs. internal memory waste MinChunk: tradeoff between internal memory waste and external memory waste Memory advantages Avoids pre-allocation of large stacks Improves paging behavior by (1) leveraging LIFO stack usage pattern to share chunks among threads and (2) placing multiple chunks on the same page CS 5204 Operating Systems 6 Threads vs. Events Resource-aware scheduling

Blocking graph Blocking graph formed dynamically Edge exponentially weighted average resource usage Node weighted average of its edge values (average resource usage of next edge) Resources CPU, memory, stack, sockets Resource-aware scheduling: Appropriate for long-running program (e.g. web servers) Scheduling annotations Nodes are points where the program blocks Arcs connect successive blocking points

Dynamically prioritize nodes/threads based on whether the thread will increase or decrease its use of each resource When a resource is scarce, schedule threads that release that resource Limitations Difficult to determine the maximum capacity of a resource Application-managed resources cannot be seen Applications that do not yield CS 5204 Operating Systems 7 Threads vs. Events Performance comparison CS 5204 Operating Systems Apache standard distribution Haboob event-based web server Knot simple, threaded specially developed web server 8

Recently Viewed Presentations

  • GCSE Circle Theorems - Maths with Miss Welton

    GCSE Circle Theorems - Maths with Miss Welton

    What are Circle Theorems. Circle Theorems are laws that apply to both . angles. and . lengths. when circles are involved. We'll deal with them in groups. #1 Non-Circle Theorems. These are not circle theorems, but are useful in questions...
  • General Data Protection Regulations: The Key Changes Craig

    General Data Protection Regulations: The Key Changes Craig

    The GDPR is intended to adopt a harmonised approach to compliance across all Member States by implementing legislation that will be directly applicable in all 28 Member States. There will be no opportunity for local transposition.
  • Welcome! []

    Welcome! []

    There is technical assistance (TA) available through ANA and AFI. Some NABI grantees have hired Native asset building consultants to provide them with TA. There are several Native asset building coalitions nationally that provide free training and technical assistance to...
  • The Laws Of Surds. - Iona Maths

    The Laws Of Surds. - Iona Maths

    These cannot be expressed as fractions and include π ,√2, 3√5 etc R What is a Surd? = 6 = 12 The above roots have exact values and are called rational These roots do NOT have exact values and are...
  • Using this template

    Using this template

    The aims of the group should include: -improving early recognition of autism by raising awareness of the signs and symptoms of autism through multi-agency training (see tables 1-3 in appendix C of the NICE guideline). -making sure the relevant professionals...
  • SSUSH12 Evaluate how westward expansion impacted the Plains ...

    SSUSH12 Evaluate how westward expansion impacted the Plains ...

    There had been various efforts to fund and build a transcontinental rail line since the early 1850s, but the monumental cost and difficulty of construction, and the onset of the Civil War delayed the project. In 1862, Congress passed the...
  • Record of Proceedings F.Y 2014-15 Health &

    Record of Proceedings F.Y 2014-15 Health &

    Release of funds. Action on the following issues would be looked at while considering the release of second tranche of funds: Compliance with Conditionalities as prescribed by Department of Expenditure (DoE) under the Ministry of Finance.
  • Psychosocial Collaboration for Hospice and Palliative Care Patients

    Psychosocial Collaboration for Hospice and Palliative Care Patients

    She received a BA in Psychology and Family Resources from St. Olaf College and her MSW from the College of St. Catherine and the University of St. Thomas. Nikki began working at Children's Minnesota in 2009. Nikki provides primary coverage...