-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlearn.html
More file actions
830 lines (719 loc) · 27.9 KB
/
learn.html
File metadata and controls
830 lines (719 loc) · 27.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Learn | SMT-Aware Job Scheduling System</title>
<meta name="description" content="Learn about IPC, SMT, thread pools, and priority scheduling concepts">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3e 50%, #0a0a1a 100%);
color: #e0e0e0;
min-height: 100vh;
line-height: 1.7;
}
/* Navigation */
nav {
position: fixed;
top: 0;
width: 100%;
padding: 20px 40px;
display: flex;
justify-content: space-between;
align-items: center;
z-index: 1000;
background: rgba(10, 10, 26, 0.95);
backdrop-filter: blur(10px);
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.logo {
font-size: 1.5rem;
font-weight: 700;
color: #00d4ff;
text-decoration: none;
display: flex;
align-items: center;
gap: 10px;
}
.logo-icon {
width: 40px;
height: 40px;
background: linear-gradient(135deg, #00d4ff, #6464ff);
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.2rem;
}
.nav-links {
display: flex;
gap: 30px;
}
.nav-links a {
color: #888;
text-decoration: none;
font-weight: 500;
transition: color 0.3s;
padding: 8px 16px;
border-radius: 8px;
}
.nav-links a:hover,
.nav-links a.active {
color: #00d4ff;
background: rgba(0, 212, 255, 0.1);
}
/* Main Content */
main {
max-width: 1000px;
margin: 0 auto;
padding: 120px 40px 80px;
}
.page-header {
text-align: center;
margin-bottom: 60px;
}
.page-header h1 {
font-size: 2.5rem;
background: linear-gradient(135deg, #fff, #00d4ff);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin-bottom: 15px;
}
.page-header p {
color: #888;
font-size: 1.1rem;
}
/* Table of Contents */
.toc {
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 16px;
padding: 30px;
margin-bottom: 50px;
}
.toc h2 {
font-size: 1.2rem;
color: #00d4ff;
margin-bottom: 20px;
}
.toc-list {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 10px;
list-style: none;
}
.toc-list a {
color: #888;
text-decoration: none;
padding: 8px 15px;
border-radius: 8px;
display: block;
transition: all 0.3s;
}
.toc-list a:hover {
color: #00d4ff;
background: rgba(0, 212, 255, 0.1);
}
/* Section Styling */
section {
margin-bottom: 60px;
}
section h2 {
font-size: 1.8rem;
color: #fff;
margin-bottom: 20px;
padding-bottom: 15px;
border-bottom: 2px solid rgba(0, 212, 255, 0.3);
}
section h3 {
font-size: 1.3rem;
color: #00d4ff;
margin: 30px 0 15px;
}
p {
margin-bottom: 15px;
color: #bbb;
}
/* Code Blocks */
pre {
background: rgba(0, 0, 0, 0.4);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 10px;
padding: 20px;
overflow-x: auto;
font-family: 'SF Mono', 'Monaco', 'Fira Code', monospace;
font-size: 0.85rem;
margin: 20px 0;
line-height: 1.5;
}
code {
font-family: 'SF Mono', 'Monaco', 'Fira Code', monospace;
background: rgba(0, 212, 255, 0.1);
padding: 2px 6px;
border-radius: 4px;
font-size: 0.9em;
color: #00d4ff;
}
pre code {
background: none;
padding: 0;
color: #e0e0e0;
}
/* Info Boxes */
.info-box {
background: rgba(0, 212, 255, 0.1);
border-left: 4px solid #00d4ff;
padding: 20px;
border-radius: 0 10px 10px 0;
margin: 20px 0;
}
.warning-box {
background: rgba(255, 165, 0, 0.1);
border-left: 4px solid #ffa500;
padding: 20px;
border-radius: 0 10px 10px 0;
margin: 20px 0;
}
/* Glossary */
.glossary-grid {
display: grid;
gap: 20px;
}
.glossary-item {
background: rgba(255, 255, 255, 0.02);
border: 1px solid rgba(255, 255, 255, 0.06);
border-radius: 12px;
padding: 25px;
}
.glossary-term {
font-size: 1.1rem;
font-weight: 600;
color: #00d4ff;
margin-bottom: 10px;
}
.glossary-def {
color: #999;
font-size: 0.95rem;
}
/* Mini Simulations */
.mini-sim {
background: rgba(0, 0, 0, 0.3);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 16px;
padding: 30px;
margin: 30px 0;
}
.mini-sim h4 {
color: #fff;
margin-bottom: 20px;
font-size: 1.1rem;
}
.sim-container {
display: flex;
align-items: center;
gap: 20px;
flex-wrap: wrap;
justify-content: center;
}
.sim-box {
padding: 15px 25px;
border-radius: 10px;
text-align: center;
min-width: 100px;
}
.sim-producer {
background: rgba(0, 200, 150, 0.2);
border: 1px solid #00c896;
}
.sim-queue {
background: rgba(255, 200, 0, 0.2);
border: 1px solid #ffc800;
}
.sim-worker {
background: rgba(100, 100, 255, 0.2);
border: 1px solid #6464ff;
}
.sim-arrow {
font-size: 1.5rem;
color: #00d4ff;
animation: arrowPulse 1s ease infinite;
}
@keyframes arrowPulse {
0%,
100% {
opacity: 0.5;
}
50% {
opacity: 1;
}
}
.sim-job {
display: inline-block;
padding: 4px 10px;
border-radius: 4px;
font-size: 0.75rem;
margin: 2px;
animation: jobMove 2s ease infinite;
}
.job-critical {
background: rgba(255, 71, 87, 0.4);
}
.job-high {
background: rgba(255, 165, 0, 0.4);
}
.job-medium {
background: rgba(255, 255, 0, 0.3);
}
.job-low {
background: rgba(0, 255, 0, 0.3);
}
@keyframes jobMove {
0%,
100% {
transform: translateY(0);
}
50% {
transform: translateY(-3px);
}
}
/* SMT Diagram */
.smt-diagram {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
margin: 20px 0;
}
.physical-core-demo {
background: rgba(255, 165, 0, 0.1);
border: 2px solid rgba(255, 165, 0, 0.4);
border-radius: 12px;
padding: 20px;
text-align: center;
}
.physical-core-demo.contention {
border-color: #ff4757;
background: rgba(255, 71, 87, 0.1);
animation: contentionPulse 1s ease infinite alternate;
}
@keyframes contentionPulse {
from {
box-shadow: 0 0 10px rgba(255, 71, 87, 0.3);
}
to {
box-shadow: 0 0 25px rgba(255, 71, 87, 0.5);
}
}
.logical-cores-demo {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
margin-top: 15px;
}
.logical-core-demo {
background: rgba(0, 0, 0, 0.3);
padding: 15px;
border-radius: 8px;
}
.logical-core-demo.active {
background: rgba(0, 212, 255, 0.2);
border: 1px solid #00d4ff;
}
/* Thread Pool Animation */
.thread-pool-demo {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 10px;
margin: 20px 0;
}
.thread-demo {
padding: 15px;
border-radius: 8px;
text-align: center;
font-size: 0.8rem;
transition: all 0.3s;
}
.thread-idle {
background: rgba(100, 100, 100, 0.3);
border: 1px dashed #555;
color: #666;
}
.thread-busy {
background: rgba(0, 212, 255, 0.3);
border: 1px solid #00d4ff;
color: #00d4ff;
animation: threadWork 0.5s ease infinite alternate;
}
@keyframes threadWork {
from {
box-shadow: 0 0 5px rgba(0, 212, 255, 0.3);
}
to {
box-shadow: 0 0 15px rgba(0, 212, 255, 0.6);
}
}
/* Interactive Demo Button */
.demo-btn {
background: linear-gradient(135deg, #00d4ff, #0099cc);
color: #000;
border: none;
padding: 10px 25px;
border-radius: 8px;
cursor: pointer;
font-weight: 600;
margin: 10px;
transition: transform 0.3s;
}
.demo-btn:hover {
transform: translateY(-2px);
}
/* Footer */
footer {
padding: 40px;
text-align: center;
border-top: 1px solid rgba(255, 255, 255, 0.05);
color: #555;
font-size: 0.85rem;
}
footer a {
color: #00d4ff;
text-decoration: none;
}
@media (max-width: 768px) {
main {
padding: 100px 20px 60px;
}
.page-header h1 {
font-size: 1.8rem;
}
nav {
padding: 15px 20px;
}
}
</style>
</head>
<body>
<nav>
<a href="index.html" class="logo">
<div class="logo-icon"></div>
<span>IPC Framework</span>
</a>
<div class="nav-links">
<a href="index.html">Home</a>
<a href="smt_scheduler_visualization.html">Visualizer</a>
<a href="learn.html" class="active">Learn</a>
</div>
</nav>
<main>
<div class="page-header">
<h1>Learn and Explore</h1>
<p>Understand the concepts behind the SMT-Aware Job Scheduling System</p>
</div>
<!-- Table of Contents -->
<div class="toc">
<h2>Table of Contents</h2>
<ul class="toc-list">
<li><a href="#overview">1. Project Overview</a></li>
<li><a href="#ipc">2. Inter-Process Communication</a></li>
<li><a href="#threading">3. Threading & Thread Pools</a></li>
<li><a href="#smt">4. SMT & Hyperthreading</a></li>
<li><a href="#scheduling">5. Priority Scheduling</a></li>
<li><a href="#glossary">6. Glossary</a></li>
</ul>
</div>
<!-- Project Overview -->
<section id="overview">
<h2>1. Project Overview</h2>
<p>This project demonstrates a <strong>multi-process job scheduling system</strong> that showcases several
key Linux systems programming concepts. The system consists of three main components:</p>
<div class="mini-sim">
<h4>System Flow</h4>
<div class="sim-container">
<div class="sim-box sim-producer">
<strong>Producers</strong><br>
<small>Generate Jobs</small>
</div>
<div class="sim-arrow">→</div>
<div class="sim-box sim-queue">
<strong>Scheduler</strong><br>
<small>Priority Queue</small>
</div>
<div class="sim-arrow">→</div>
<div class="sim-box sim-worker">
<strong>Workers</strong><br>
<small>Thread Pools</small>
</div>
</div>
</div>
<h3>How It Works</h3>
<ol style="color: #bbb; margin-left: 20px;">
<li style="margin-bottom: 10px;"><strong>Producers</strong> generate jobs with random priorities and
complexities, sending them to the scheduler via a message queue.</li>
<li style="margin-bottom: 10px;"><strong>Scheduler</strong> receives jobs, sorts them by priority, and
dispatches them to the least-loaded worker.</li>
<li style="margin-bottom: 10px;"><strong>Workers</strong> use internal thread pools to execute jobs
concurrently, with CPU affinity for SMT awareness.</li>
</ol>
<div class="info-box">
<strong>Key Insight:</strong> Each component runs as a separate process, communicating through System
V IPC mechanisms. This demonstrates real-world multi-process architecture.
</div>
</section>
<!-- IPC Section -->
<section id="ipc">
<h2>2. Inter-Process Communication (IPC)</h2>
<p>IPC allows separate processes to exchange data. This project uses <strong>System V IPC</strong>, which
provides:</p>
<h3>Message Queues</h3>
<p>Message queues allow processes to send structured messages to each other. The scheduler creates a queue
that producers write to and workers read from.</p>
<pre><code>// Create or connect to a message queue
int msg_queue_id = msgget(MSG_QUEUE_KEY, IPC_CREAT | 0666);
// Send a message
msgsnd(msg_queue_id, &message, sizeof(message), 0);
// Receive a message (filtered by type)
msgrcv(msg_queue_id, &message, sizeof(message), MSG_TYPE_JOB, 0);</code></pre>
<h3>Shared Memory</h3>
<p>Shared memory allows multiple processes to access the same memory region. We use it to store worker
status and job counters.</p>
<pre><code>// Create shared memory segment
int shm_id = shmget(SHM_KEY, sizeof(shared_state_t), IPC_CREAT | 0666);
// Attach to shared memory
shared_state_t *shared = shmat(shm_id, NULL, 0);
// Now 'shared' can be accessed by any attached process</code></pre>
<div class="warning-box">
<strong>Important:</strong> When using shared memory between processes, you need
<code>PTHREAD_PROCESS_SHARED</code> mutexes for synchronization!
</div>
</section>
<!-- Threading Section -->
<section id="threading">
<h2>3. Threading & Thread Pools</h2>
<p>Each worker maintains a <strong>thread pool</strong> — a fixed set of threads that wait for jobs and
execute them. This is more efficient than creating new threads for each job.</p>
<div class="mini-sim">
<h4>Thread Pool Visualization</h4>
<div class="thread-pool-demo" id="thread-pool-demo">
<div class="thread-demo thread-idle" id="demo-thread-0">Thread 0<br><small>Idle</small></div>
<div class="thread-demo thread-busy" id="demo-thread-1">Thread 1<br><small>Job 42</small></div>
<div class="thread-demo thread-busy" id="demo-thread-2">Thread 2<br><small>Job 43</small></div>
<div class="thread-demo thread-idle" id="demo-thread-3">Thread 3<br><small>Idle</small></div>
</div>
<div style="text-align: center;">
<button class="demo-btn" onclick="toggleThreadDemo()">Toggle Thread States</button>
</div>
</div>
<h3>Thread Pool Pattern</h3>
<pre><code>typedef struct {
pthread_t threads[4]; // Fixed thread array
pthread_mutex_t queue_lock; // Protects the job queue
pthread_cond_t queue_cond; // Signals when jobs arrive
job_queue_entry_t *queue; // Linked list of pending jobs
} thread_pool_t;
// Worker thread function
void *worker_thread(void *arg) {
while (!shutdown) {
pthread_mutex_lock(&queue_lock);
while (queue == NULL && !shutdown) {
pthread_cond_wait(&queue_cond, &queue_lock); // Wait for job
}
job = dequeue();
pthread_mutex_unlock(&queue_lock);
execute_job(job); // Do the work
}
}</code></pre>
<div class="info-box">
<strong>Why Thread Pools?</strong> Creating threads is expensive. Thread pools reuse threads,
reducing overhead and improving response time.
</div>
</section>
<!-- SMT Section -->
<section id="smt">
<h2>4. SMT & Hyperthreading</h2>
<p><strong>Simultaneous Multithreading (SMT)</strong>, called Hyperthreading on Intel CPUs, allows a single
physical CPU core to run multiple threads by sharing execution resources.</p>
<div class="mini-sim">
<h4>Physical vs Logical Cores</h4>
<div class="smt-diagram">
<div class="physical-core-demo" id="pcore-0">
<strong style="color: #ffa500;">Physical Core 0</strong>
<div class="logical-cores-demo">
<div class="logical-core-demo active" id="lcore-0">
<small>Logical 0</small><br>
<span style="color: #00d4ff;">W0:T0</span>
</div>
<div class="logical-core-demo" id="lcore-1">
<small>Logical 1</small><br>
<span style="color: #666;">-</span>
</div>
</div>
<div style="margin-top: 10px; font-size: 0.8rem; color: #00ff00;">✓ Optimal</div>
</div>
<div class="physical-core-demo contention" id="pcore-1">
<strong style="color: #ffa500;">Physical Core 1</strong>
<div class="logical-cores-demo">
<div class="logical-core-demo active">
<small>Logical 2</small><br>
<span style="color: #00d4ff;">W1:T0</span>
</div>
<div class="logical-core-demo active">
<small>Logical 3</small><br>
<span style="color: #00d4ff;">W1:T1</span>
</div>
</div>
<div style="margin-top: 10px; font-size: 0.8rem; color: #ff4757;">SMT Contention</div>
</div>
</div>
</div>
<h3>CPU Affinity</h3>
<p>We can pin threads to specific CPU cores using <code>pthread_setaffinity_np()</code>:</p>
<pre><code>int pin_thread_to_core(int core_id) {
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(core_id, &cpuset);
return pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
}</code></pre>
<div class="warning-box">
<strong>SMT Trade-off:</strong> When both logical cores on the same physical core are busy, they
compete for resources. This can reduce per-thread performance by ~30%, but total throughput may still
increase.
</div>
</section>
<!-- Priority Scheduling -->
<section id="scheduling">
<h2>5. Priority Scheduling</h2>
<p>Jobs are assigned priorities from 1 (Low) to 4 (Critical). The scheduler maintains a <strong>priority
queue</strong> that always processes higher-priority jobs first.</p>
<div class="mini-sim">
<h4>Priority Queue</h4>
<div style="display: flex; flex-direction: column; gap: 5px; max-width: 300px; margin: 0 auto;">
<div class="sim-job job-critical">CRITICAL - Job 15</div>
<div class="sim-job job-critical">CRITICAL - Job 22</div>
<div class="sim-job job-high">HIGH - Job 18</div>
<div class="sim-job job-medium">MEDIUM - Job 12</div>
<div class="sim-job job-low">LOW - Job 8</div>
<div class="sim-job job-low">LOW - Job 5</div>
</div>
<p style="text-align: center; margin-top: 15px; color: #888; font-size: 0.9rem;">← Jobs processed from
top (highest priority first)</p>
</div>
<h3>Load-Balanced Dispatch</h3>
<p>The scheduler also considers worker load when dispatching. It selects the worker with the fewest active
threads:</p>
<pre><code>int select_worker(void) {
int best_worker = 0;
int min_load = workers[0].current_load;
for (int i = 1; i < MAX_WORKERS; i++) {
if (workers[i].current_load < min_load) {
min_load = workers[i].current_load;
best_worker = i;
}
}
return best_worker;
}</code></pre>
</section>
<!-- Glossary -->
<section id="glossary">
<h2>6. Glossary</h2>
<div class="glossary-grid">
<div class="glossary-item">
<div class="glossary-term">IPC (Inter-Process Communication)</div>
<div class="glossary-def">Mechanisms that allow processes to exchange data and synchronize. Includes
message queues, shared memory, pipes, and sockets.</div>
</div>
<div class="glossary-item">
<div class="glossary-term">System V IPC</div>
<div class="glossary-def">A set of IPC mechanisms originating from Unix System V, including message
queues (msgget), shared memory (shmget), and semaphores (semget).</div>
</div>
<div class="glossary-item">
<div class="glossary-term">Thread Pool</div>
<div class="glossary-def">A design pattern where a fixed number of threads wait in a pool for work.
Reusing threads avoids the overhead of creating/destroying threads.</div>
</div>
<div class="glossary-item">
<div class="glossary-term">SMT (Simultaneous Multithreading)</div>
<div class="glossary-def">Hardware technique allowing multiple threads to run on a single CPU core
by sharing execution units. Intel's implementation is called Hyperthreading.</div>
</div>
<div class="glossary-item">
<div class="glossary-term">CPU Affinity</div>
<div class="glossary-def">Binding a thread or process to run on specific CPU cores. Used to optimize
cache usage and control SMT behavior.</div>
</div>
<div class="glossary-item">
<div class="glossary-term">Mutex (Mutual Exclusion)</div>
<div class="glossary-def">A synchronization primitive that prevents multiple threads from accessing
shared resources simultaneously.</div>
</div>
<div class="glossary-item">
<div class="glossary-term">Condition Variable</div>
<div class="glossary-def">A synchronization primitive that allows threads to wait until a particular
condition is true. Used with pthread_cond_wait().</div>
</div>
<div class="glossary-item">
<div class="glossary-term">Priority Queue</div>
<div class="glossary-def">A data structure where elements are dequeued based on priority rather than
insertion order. Higher priority items are processed first.</div>
</div>
<div class="glossary-item">
<div class="glossary-term">Message Queue</div>
<div class="glossary-def">An IPC mechanism for sending structured messages between processes.
Messages can be filtered by type during receive.</div>
</div>
<div class="glossary-item">
<div class="glossary-term">Shared Memory</div>
<div class="glossary-def">An IPC mechanism where multiple processes can access the same physical
memory region. Fastest form of IPC but requires explicit synchronization.</div>
</div>
</div>
</section>
<div style="text-align: center; margin-top: 50px;">
<a href="smt_scheduler_visualization.html" class="demo-btn"
style="text-decoration: none; display: inline-block;">Try the Interactive Visualizer</a>
</div>
</main>
<footer>
<p>Educational project for Linux systems programming | <a
href="https://github.com/Adhithi02/linux-ipc-framework" target="_blank">View on GitHub</a></p>
</footer>
<script>
// Thread pool demo toggle
let demoState = 0;
const demoStates = [
[false, true, true, false],
[true, false, true, true],
[true, true, false, false],
[false, false, true, true]
];
function toggleThreadDemo() {
demoState = (demoState + 1) % demoStates.length;
const state = demoStates[demoState];
for (let i = 0; i < 4; i++) {
const el = document.getElementById(`demo-thread-${i}`);
if (state[i]) {
el.className = 'thread-demo thread-busy';
el.innerHTML = `Thread ${i}<br><small>Job ${40 + Math.floor(Math.random() * 20)}</small>`;
} else {
el.className = 'thread-demo thread-idle';
el.innerHTML = `Thread ${i}<br><small>Idle</small>`;
}
}
}
// Smooth scroll for TOC links
document.querySelectorAll('.toc-list a').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
target.scrollIntoView({ behavior: 'smooth', block: 'start' });
});
});
</script>
</body>
</html>