College of Computer Science & Information Technology King Khalid University · جامعة الملك خالد
Week
Week 5
Topic
Synchronization
Workload
6–8 Hours
Status
Materials Placeholder
OverviewScheduleObjectivesMaterialsReadingLabAssignmentQuizDownloadsChecklist
Module Overview

Week 5 addresses the correctness problems caused by concurrent execution. Students learn how locks protect shared state and how condition variables allow threads to wait for events.

Lecture
Locks, critical sections, and condition variables
Reading
OSTEP Chapters 28–30
Lab
pthread mutexes and condition variables
Due
Update date later
Weekly Schedule
TimeActivityWhat Students DoLink
Before LecturePreparation ReadingRead OSTEP Chapters 28–30 and identify one real example of shared data.Book →
Lecture 1Critical Sections and LocksRace conditions, atomicity, mutual exclusion, lock acquire/release, and lock correctness.Slides →
Lecture 2Condition VariablesWaiting, signaling, producer-consumer patterns, and avoiding busy waiting.Slides →
Lab SessionSynchronization LabProtect a shared counter using mutexes and coordinate threads using condition variables.Lab →
After LectureAssignment 5Implement a bounded buffer with producer and consumer threads.Assignment →
End of WeekQuiz 5Complete short quiz on critical sections, locks, mutexes, condition variables, and producer-consumer coordination.Quiz →
Learning Objectives
Outcome
By the end of Week 5, students should be able to:

Identify race conditions, protect critical sections using mutex locks, use condition variables, and explain why synchronization is required.

LocksMutexCondition VariablesProducer Consumer
Module 5
Core
Lecture Materials
Slides
Week 5 Lecture Slides

Slides for synchronization and locks. Replace this placeholder with your final PDF or Google Slides link.

PDFLectureRequired
Slides
Lecture
Open Slides →
Notes
Week 5 Lecture Notes

Instructor notes and class summary for review after lecture and before assessment.

PDFReviewSummary
PDF
Notes
Download →
Video
Lecture Recording

Placeholder for lecture recording or external video link. Replace this href with YouTube, Blackboard, or local recording URL.

VideoRecordingOptional Review
Video
TBD
Watch →
Code
Starter Code

Starter files, examples, and templates for the Week 5 lab and assignment.

CLinuxStarter
ZIP
Starter
Download →
Reading
Required
OSTEP Chapters 28–30

Complete the assigned reading before lecture. Focus on definitions, mechanisms, tradeoffs, and examples that connect to the lab.

RequiredReadingPreparation
Required
Book/Notes
Open →
Reference
Linux man-pages Project

Use this reference to look up commands, system calls, library calls, and Linux behavior related to this week.

LinuxManualReference
Reference
man7
Open →
Lab
Lab 5
Synchronization Lab

Protect a shared counter using mutexes and coordinate threads using condition variables.

Hands-onLinuxC
Required
90 min
Open Lab →
Assignment
HW 5
Week 5 Assignment

Implement a bounded buffer with producer and consumer threads. Submit source code, screenshots, and a short explanation.

HomeworkSubmissionReport
10 points
Due TBD
Download →
Quiz
Quiz 5
Week 5 Quiz

Short quiz covering critical sections, locks, mutexes, condition variables, and producer-consumer coordination.

10 Questions15 MinutesOnline
Quiz
TBD
Start →
All Downloads
Files
Week 5 File Package

Central download area for slides, notes, lab, assignment, starter code, and reference files. Replace placeholder paths after uploading final files.

SlidesNotesLabAssignmentCode
Student Checklist
  • □ Complete preparation reading
  • □ Open Week 5 slides
  • □ Review lecture notes
  • □ Complete Lab 5
  • □ Submit Assignment 5
  • □ Complete Quiz 5
  • □ Save screenshots and code
  • □ Prepare questions for next week

Week 6 focuses on deadlocks. Students should understand locks before studying what happens when locks are used incorrectly.