Threads-Birell - An Introduction to Programming with C#...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: An Introduction to Programming with C# Threads Andrew D. Birrell This paper provides an introduction to writing concurrent programs with threads. A threads facility allows you to write programs with multiple simultaneous points of execution, synchronizing through shared memory. The paper describes the basic thread and synchronization primitives, then for each primitive provides a tutorial on how to use it. The tutorial sections provide advice on the best ways to use the primitives, give warnings about what can go wrong and offer hints about how to avoid these pitfalls. The paper is aimed at experienced programmers who want to acquire practical expertise in writing concurrent programs. The programming language used is C#, but most of the tutorial applies equally well to other languages with thread support, such as Java. Categories and Subject Descriptors: D.1.3 [ Programming Techniques ]: Concurrent Programming; D.3.3 [ Programming Languages ]: Language Constructs and Features Concurrent programming structures ; D.4.1 [ Operating Systems ]: Process Management General Terms: Design, Languages, Performance Additional Key Words and Phrases: Threads, Concurrency, Multi-processing, Synchronization CONTENTS 1. Introduction .............................................................................................................. 1 2. Why use concurrency? ............................................................................................ 2 3. The design of a thread facility................................................................................ 3 4. Using Locks: accessing shared data....................................................................... 8 5. Using Wait and Pulse: scheduling shared resources......................................... 16 6. Using Threads: working in parallel..................................................................... 25 7. Using Interrupt: diverting the flow of control ................................................... 31 8. Additional techniques ........................................................................................... 33 9. Advanced C# Features........................................................................................... 36 10. Building your program ......................................................................................... 36 11. Concluding remarks .............................................................................................. 38 Microsoft Corporation 2003. Permission to copy in whole or part without payment of fee is granted for non- profit educational and research purposes provided that all such whole or partial copies include the following: a notice that such copying is by permission of Microsoft Corporation; an acknowledgement of the author of the work; and this copyright notice. Parts of this work are based on research report #35 published in 1989 by the Systems Research Center of Digital Equipment Corporation and copyright by them. That material is used here by kind permission of Hewlett- Packard Company. All rights reserved. An Introduction to Programming with C# Threads...
View Full Document

This note was uploaded on 07/30/2011 for the course COP 4600 taught by Professor Montagne during the Spring '08 term at University of Central Florida.

Page1 / 40

Threads-Birell - An Introduction to Programming with C#...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online