Advanced Linux Threads Senior Team Project Fall Semester 1999 Department of Computer Science Univers - PowerPoint PPT Presentation

1 / 31
About This Presentation
Title:

Advanced Linux Threads Senior Team Project Fall Semester 1999 Department of Computer Science Univers

Description:

Advanced Linux Threads. Senior Team Project. Fall Semester 1999. Department of Computer Science ... Lack of documentation and comments: No book on the latest kernel ... – PowerPoint PPT presentation

Number of Views:53
Avg rating:3.0/5.0
Slides: 32
Provided by: SonG67
Category:

less

Transcript and Presenter's Notes

Title: Advanced Linux Threads Senior Team Project Fall Semester 1999 Department of Computer Science Univers


1
Advanced Linux ThreadsSenior Team ProjectFall
Semester 1999Department of Computer
ScienceUniversity of San Francisco
2
Contents
  • Introduction to concurrent programming
  • Current thread implementations
  • Researchs goals
  • Designs issues
  • Approaches
  • Implementation
  • Benchmarks
  • Acknowledgement

3
Introduction to Concurrent Programming
  • Concurrent
  • Programming
  • Multiple threads of control executing parallel
  • Sequential
  • Programming
  • A single thread of control
  • Simple structure
  • Do not share resources
  • Cannot utilize multi-processors
  • Complex Structure
  • Share resources
  • Utilize multi-processors

4
Processes vs. Threads
  • Processes
  • Poor communication
  • Heavy-weight
  • Poor performance
  • Threads
  • Tight communication
  • Light-weight
  • Fast performance

5
Thread Implementation Techniques
  • Kernel-level Threads
  • Light-weight processes with shared code and data
    spaces
  • Support I/O blocking
  • Slow context switch
  • User-level Threads
  • Multiplexing threads within a single process
  • No blocking support
  • Fast context switch

6
Example
7
Disadvantages of Kernel-level Threads
  • Inherent expensive context-switch time from Unix
    process
  • No application control
  • Inflexible low-level thread operations
  • Hard to maintain

8
Disadvantages of User-level Threads
  • No I/O support from kernel when one thread
    blocks, other threads in the same process block
  • No protection for critical section from the
    kernel

9
Researchs Goals
  • Develop new thread systems that combine the
    advantages of the two thread models
  • Good performance context switch time
  • Tight integration between kernel and user-level
    threads support I/O blocking
  • Maintain compatibility with standard interface
    POSIX threads
  • Evaluate our new threads systems
  • Microbenchmarks (thread operations)
  • Macrobenchmarks (multi-threaded applications)

10
Design Issues
Pthread Scheduler
Library
Notify I/O events
Notify new decision
Kernel
Kernel Thread Scheduler
11
Initial Approaches
  • Light-weight processes
  • Communication based on signal system in Unix
  • Scheduler activations
  • Communication based on up call technique

12
Light-weight Processes
13
Light-weight Processes
14
Light-weight Processes
15
Light-weight Processes
16
Scheduler Activations
17
Scheduler Activations
18
Scheduler Activations
19
Scheduler Activations
20
Scheduler Activations
21
Scheduler Activations API(public methods)
  • sa_register (void) to register a VP to kernel
    for SAs functionalities
  • sa_setblockedhandler (int handler) register the
    blocking handler
  • sa_setunblockedhandler (int handler) register
    the unblocking handler
  • sa_setchildstack (void childstack, long num)
  • sa_resumevp (unsigned long vpid) resume a VP

22
Scheduler Activations API(public methods)
23
Scheduler Activations API(private methods)
  • void sa_blocked_notice (void)
  • void sa_unblocked_notice (void)
  • void sa_getchildstack (long is_out_of_stack)
  • long sa_getfreeslot (void)

(These methods reside in the kernel)
24
Stack Layout of an Up-call
(when entering the block/unblock handler in
user-level space)
25
Microbenchmarks
All numbers are in micro second
26
Low-level Debugging Experience
  • No fancy debug tools
  • Time consuming
  • - rebooting time 5-10 minutes

27
Debugging Experience (cont.)
  • Multi-threaded environment
  • - Expected output
  • address thread1 66FAFF00 address thread2
    66FAFFA0
  • - Actual output
  • address address threathreadd12
    66FA66FAFF0A00

28
Race Condition
  • Difficult to track rarely occur
  • Difficult to debug different debugging output
    for each occurrence

29
Software Engineering Issues
  • Violating SEs conventions
  • to improve speed performance
  • Lack of documentation and comments
  • No book on the latest kernel
  • Very few comments in the Linux kernel code

30
Future Work
  • Fix SMP bugs
  • More microbenchmarks in other thread mechanisms
  • Macrobenchmarks multi-threaded applications
  • Complete the functionality of standard POSIX
    threads

31
Acknowledgement
  • Professor Greg Benson client/supervisor
  • Professor Allan Cruse debugging support
  • Chin-To Kwong implementing user-level threads
Write a Comment
User Comments (0)
About PowerShow.com