110 likes | 254 Views
System Level Programming Software College of SCU. 四川大学软件学院 舒莉. Lab 15. Concurrent Programming. The Problem of Producer and Consumer Read the code in file week15 lab_code.cpp A console program Uses Critical Section One Producer, One Consumer Buffer size is 1 Problems in it
E N D
System Level ProgrammingSoftware College of SCU 四川大学软件学院 舒莉
Lab 15. Concurrent Programming • The Problem of Producer and Consumer • Read the code in file • week15 lab_code.cpp • A console program • Uses Critical Section • One Producer, One Consumer • Buffer size is 1 • Problems in it • Synchronization? • Mutual Exclusion? 201001V1.1
Lab 15. Concurrent Programming • The Problem of Producer and Consumer • Rewrite it, you • Can re-use parts of the code given • Port it from console to GUI • You make the decision on what to use • Four practice are provided • Practice 1 • Practice 2 • Practice 3 • Practice 4 [optional] • Practice 5 [optional] 201001V1.1
Lab 15. Concurrent Programming • Practice1: • To use the Critical Section to fulfill Mutual Exclusion • One Producer, One Consumer • Buffer size is 1 201001V1.1
Lab 15. Concurrent Programming • Practice2: • To use the Event Kernel Object to fulfill Synchronization (and Mutual Exclusion) (optional) • One Producer, One Consumer • Buffer size is 1 201001V1.1
Lab 15. Concurrent Programming • Practice3: • To use Semaphore and Mutex fulfill Synchronization and Mutual Exclusion • One Producer, One Consumer • Buffer size is 1 201001V1.1
Lab 15. Concurrent Programming • Practice4: [optional] • To use Semaphore and Mutex fulfill Synchronization and Mutual Exclusion • One Producer, One Consumer • Buffer size is 5 • Circle queue 201001V1.1
Lab 15. Concurrent Programming • Practice5: [optional] • To use Semaphore and Mutex fulfill Synchronization and Mutual Exclusion • Two Producer, Two Consumer • Buffer size is 5 • Circle queue 201001V1.1
Lab 15. Concurrent Programming • 本次Lab需要完成的提交:学号_姓名_week15.rar: • 文件1/2: practice1.rar • project1.rar [删除掉debug目录再压缩!] • project1.doc [概要设计文档] • 文件2/3: practice2.rar • project2.rar [删除掉debug目录再压缩!] • project2.doc [概要设计文档] • 文件3/3: practice3.rar • project3.rar [删除掉debug目录再压缩!] • project3.doc [概要设计文档] • Upload to module @week15 • Due:see it on the Moodle 201001V1.1
Lab 15. Concurrent Programming • 本次Lab需要完成的提交:学号_姓名_week15.rar: • 文件1/5: practice1.rar • project1.rar [删除掉debug目录再压缩!] • project1.doc [概要设计文档] • 文件2/5: practice2.rar • project2.rar [删除掉debug目录再压缩!] • project2.doc [概要设计文档] • 文件3/5: practice3.rar • project3.rar [删除掉debug目录再压缩!] • project3.doc [概要设计文档] • 文件4/5: practice2.rar • project4.rar [删除掉debug目录再压缩!] • project4.doc [概要设计文档] • 文件5/5: practice2.rar • project5.rar [删除掉debug目录再压缩!] • project5.doc [概要设计文档] • Upload to module @week15 • Due:see it on the Moodle 201001V1.1
Lab 15. Concurrent Programming • Multiple choice question • Due:See it on Moodle 201001V1.1