From my notes Flashcards
the points I found important from lectures and tutorials (27 cards)
מהו תהליך?
תהליך הוא תוכנית בזמן הריצה שלה
מהם חלקי תהליך?
text section הקוד
current activity רגיסטר שאומר איפה אנחנו בתהליך
stack הזיכרון הלא מוקצה דינמית שהתהליך משתמש בו - גודלו יכול להשתנות בזמן ריצת התהליך
Data המשתנים הגלובלים
Heap הזיכרון המוקצה דינמית במהלך ריצת התהליך - גודלו יכול להשתנות במהלך ריצת התהליך
Text, current activity, stack, Data, heap
מהו ההבדל בין תוכנית program ותהליך process?
תוכנית = program
תהליך = process
Program is passive entity stored on disk (executable file)
However, process is active
draw the sections of a process
max
+——-+
| stack | ← (grows downward)
+——-+
| |
| | (gap for growth)
| |
+——-+
| heap | ← (grows upward)
+——-+
| data |
+——-+
| text |
+——-+
0
what are the states of a process?
New: it is being created
Running: Instructions are being executed
Waiting: it is waiting for some event to occur
Ready: it is waiting to be assigned to a processor
Terminated: it has finished execution
New, Running, Waiting, Ready, Terminated
draw the states of a process
First write the states
Then add these arrows:
new -> ready: Admitted (Process is admitted into the ready queue by the OS)
ready -> running: Scheduler dispatch (CPU scheduler selects process to run)
running -> ready: Interrupt (Process is preempted and moved back to ready state)
running -> waiting: I/O or event wait (Process requests I/O or waits for an event)
waiting -> ready: I/O or event completion (I/O operation completes, process moves to ready)
running -> terminated: Exit (Process finishes execution and is terminated)
there should be 6 arrows and they are described above
what a process control block (PCB) contain?
Process state – running, waiting, etc.
Program counter – location of instruction to next execute
CPU registers – contents of all process-centric registers
CPU scheduling information- priorities, scheduling queue pointers
Memory-management information – memory allocated to the process
Accounting information – CPU used, clock time elapsed since start, time limits
I/O status information – I/O devices allocated to process, list of open files
7 things
Process state, Program counter, CPU registers, CPU scheduling information, Memory-management information, Accounting information, I/O status information
נכון או לא?
סיגנלים = פסיקות
לא נכון
מה kill עושה?
שולח לתהליך מסויים סיגנל מסויים
סתם שם מבלבל שלא משקף מה הפונקציה עושה
נכון או לא?
ניתן לטפל בדרך שהיא לא ה default בכל סיגנל
לא נכון
בכל סיגנל ניתן לטפל בדרך שהיא לא Default
פרט ל
SIGKILL (9) ו SIGSTOP (17)
What are the types of system calls?
Process control
File managment
Device management
Information maintenance
Communications
Protection
מה קורה בעת הדלקת המחשב?
- BIOS (Basic Input/Output System)
- Bootable device
- MBR (Master Boot Record)
- Boot Loader
איך פועל BIOS ומהי מטרתו?
זהו הקוד הראשון שרץ כשמדליקים את המחשב.
BIOS מאוחסן על שבב בלוח האם.
תפקידו לבדוק את תקינות החומרה (POST – Power-On Self Test) ולזהות התקני אחסון (כמו דיסק קשיח).
לאחר מכן, הוא מחפש התקן אתחול (bootable) לפי סדר שנקבע בהגדרות BIOS.
what is a bootable device?
זהו התקן (למשל דיסק קשיח, דיסק און קי, וכו’) שיש עליו מערכת הפעלה או קבצי אתחול.
ה-BIOS מנסה לאתר התקן שניתן לאתחל ממנו.
אם לא נמצא התקן כזה – תופיע שגיאה בסגנון “No bootable device found”.
What is MBR (Master Boot Record)
ברגע שה-BIOS מזהה התקן אתחול, הוא טוען את ה-MBR מה-sector הראשון של ההתקן (Sector 0).
ה-MBR כולל קוד קטן שתפקידו להעביר שליטה לטעינת מערכת ההפעלה.
הוא גם מכיל טבלת מחיצות (partition table) כדי לזהות איפה נמצאת מערכת ההפעלה.
what is a Boot Loader?
ה-MBR מפעיל את ה-boot loader (לדוגמה: GRUB בלינוקס, Windows Boot Manager).
זהו תוכנה שתפקידה לטעון את מערכת ההפעלה לזיכרון.
במערכות מרובות מערכות הפעלה (dual boot), ה-boot loader מאפשר לבחור איזו מערכת תעלה.
?מה זה מודול
קובץ קוד שמאפשר להוסיף יכולות לקרנל של מערכת ההפעלה בלי לקמפל אותו מחדש.
מהם השימושים העיקריים של מודלים?
- הרחבת פונקציונליות של הקרנל
מודולים מאפשרים להוסיף תכונות לקרנל בלי לקמפל אותו מחדש. זה שימושי מאוד לפיתוח, בדיקה או הוספת תכונות בצורה דינמית. - תמיכה בהתקני חומרה (Device Drivers)
זה השימוש הכי נפוץ – מודולים משמשים כדרייברים שמאפשרים לקרנל “לדבר” עם התקני קלט/פלט כמו עכבר, מקלדת, מצלמות, דיסקים, כרטיסי רשת וכו’. - תמיכה בפרוטוקולי רשת
למשל, אם רוצים להוסיף פרוטוקול רשת חדש (כמו VPN מסוים), אפשר לעשות זאת עם מודול. - תמיכה במערכות קבצים
אם רוצים לתמוך במערכת קבצים חדשה (כמו ext4, NTFS, FAT וכו’), אפשר להטעין מודול שמממש אותה. - יכולת דינמית: טעינה/פריקה בזמן ריצה
אפשר להטעין (insmod / modprobe) או לפרוק (rmmod) מודול בזמן שהמערכת פועלת – זה נותן גמישות גבוהה בלי אתחול. - קוד מתוחזק היטב בנפרד
מודולים מאפשרים לשמור רכיבי מערכת מורכבים (כמו דרייברים) בקוד נפרד שקל יותר לפתח ולתחזק.
מהם היתרונות של מודולים?
- גמישות
- חיסכון בזיכרון (נטען רק כשצריך)
- פיתוח קל יותר
- אין צורך לאתחל את המחשב אחרי כל שינוי
what is speedup?
Speedup is a measure of how much faster a program runs using multiple processors compared to a single processor.
How to compute speedup?
Amdahl’s Law:
((1-P)+P/N)^-1
for example: If only 80% of the program can be parallelized and you’re using 4 processors:
speedup = ((1-0.8)+0.8/4))^-1 = 2.5 ** !=** 4 = 4/1
What is an API?
An API (Application Programming Interface) is a set of rules that lets programs communicate with each other.
It’s like a menu in a restaurant: You choose from options (make a request) and the kitchen (system) gives you the dish (response).