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

Week 3 moves from processes to threads. Students learn why operating systems support multiple threads inside one process and how shared memory creates both performance benefits and correctness problems.

Lecture
Threads, concurrency, and shared memory
Reading
OSTEP Chapters 26–27
Lab
pthread_create(), pthread_join(), and shared counters
Due
Update date later
Weekly Schedule
TimeActivityWhat Students DoLink
Before LecturePreparation ReadingRead OSTEP Chapters 26–27 and write two questions about threads and concurrency.Book →
Lecture 1Thread AbstractionProcess vs thread, thread control block, stack per thread, shared address space, and context switch.Slides →
Lecture 2POSIX Threadspthread_create(), pthread_join(), thread arguments, return values, and simple race examples.Slides →
Lab SessionThread CreationCompile pthread programs, create multiple threads, and observe interleaving output.Lab →
After LectureAssignment 3Write a C program that creates multiple worker threads and computes partial sums.Assignment →
End of WeekQuiz 3Complete short quiz on threads, shared memory, pthread_create(), pthread_join(), and race conditions.Quiz →
Learning Objectives
Outcome
By the end of Week 3, students should be able to:

Explain the difference between processes and threads, describe shared address space, create POSIX threads, identify race conditions, and explain why synchronization is necessary.

ThreadspthreadsConcurrencyRace Conditions
Module 3
Core
Lecture Materials
Slides
Week 3 Lecture Slides

Slides for threads and concurrency. Replace this placeholder with your final PDF or Google Slides link.

PDFLectureRequired
Slides
Lecture
Open Slides →
Notes
Week 3 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 3 lab and assignment.

CLinuxStarter
ZIP
Starter
Download →
Reading
Required
OSTEP Chapters 26–27

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 3
Thread Creation

Compile pthread programs, create multiple threads, and observe interleaving output.

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

Write a C program that creates multiple worker threads and computes partial sums. Submit source code, screenshots, and a short explanation.

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

Short quiz covering threads, shared memory, pthread_create(), pthread_join(), and race conditions.

10 Questions15 MinutesOnline
Quiz
TBD
Start →
All Downloads
Files
Week 3 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 3 slides
  • □ Review lecture notes
  • □ Complete Lab 3
  • □ Submit Assignment 3
  • □ Complete Quiz 3
  • □ Save screenshots and code
  • □ Prepare questions for next week

Week 4 focuses on CPU scheduling. Students should be comfortable with processes and threads before studying how the OS chooses what runs next.