You are on page 1of 46

Operating Systems

‫ن ظم ا لتشغيل‬

3 ‫المحاضرة رقم‬

Operating-System
Structures

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 1


Agenda
 Kernel Data Structures
 User Operating System Interface
 System Calls
 Types of System Calls
 System Programs
 Operating System Structure
 Operating-System Debugging

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 2


KERNEL DATA STRUCTURES

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 3


Kernel Data Structures
 Many similar to standard programming data structures
 Singly linked list

 Doubly linked list

 Circular linked list

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 4


Kernel Data Structures
 Binary search tree
left <= right

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 5


Kernel Data Structures
 Hash function takes data as its input, performs a numeric
operation on this data, and returns a numeric value.
‫تأخذ البيانات كمدخالت وتنفذ عليها عمليات عددية وترجع قيمة عددية‬
 Hash function can create a hash map

 Bitmap – string of n binary digits representing the status of n


items
‫ من االشياء‬n ‫ من االرقام الثنائية تمثل حالة‬n ‫نص مكون من‬

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 6


USER OPERATING SYSTEM
INTERFACE

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 7


User Operating System Interface - CLI
CLI or command interpreter allows direct command entry
• Sometimes implemented in kernel, sometimes by systems
program
‫ واحيانا ببرامج النظام‬، ‫بعض االحيان ينفذ في النواة‬
• Sometimes multiple flavors implemented – shells
‫واحيانا يتم تنفيذه بعدة اشكال‬.
• Primarily fetches a command from user and executes it
‫ يجلب أم ًرا من المستخدم وينفذه‬، ‫في األساس‬
• Sometimes commands built-in, sometimes just names of
programs
‫ وأحيانًا أسماء البرامج فقط‬، ‫في بعض األحيان أوامر مدمجة‬

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 8


User Operating System Interface - GUI
 User-friendly desktop metaphor interface
• Usually mouse, keyboard, and monitor
‫ والشاشة‬، ‫ لوحة المفاتيح‬، ‫عادة الفارة‬
• Icons represent files, programs, actions, etc
‫ الخ‬، ‫ االحداث‬، ‫ البرامج‬، ‫االيقونات تمثل الملفات‬
• Various mouse buttons over objects in the interface cause various
actions (provide information, options, execute function, open
directory (known as a folder)
‫ى اتخاذ إجراءات‬xx‫ة إل‬xx‫ي الواجه‬xx‫ة فوق الكائنات الموجودة ف‬xx‫تؤدي أزرار الماوس المختلف‬
)‫ فتح مجلد (المعروف باسم المجلد‬، ‫ تنفيذ دوال‬، ‫ والخيارات‬، ‫مختلفة (توفير المعلومات‬

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 9


User Operating System Interface - GUI
 Many systems now include both CLI and GUI interfaces
• Microsoft Windows is GUI with CLI “command” shell
• Apple Mac OS X is “Aqua” GUI interface with UNIX kernel
underneath and shells available
• Unix and Linux have CLI with optional GUI interfaces (CDE,
KDE, GNOME)

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 10


Touchscreen Interfaces
 Touchscreen devices require new
interfaces
• Mouse not possible or not desired
• Actions and selection based on
gestures
• Virtual keyboard for text entry,
Voice commands

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 11


SYSTEM CALLS

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 12


System Calls
 Programming interface to the services provided by the OS
‫هي واجهة برمجية لخدمات النظام‬
 Typically written in a high-level language (C or C++)

‫عادة ما تكون مكتوبة بلغة عالية المستوى‬


 Mostly accessed by programs via a high-level Application
Programming Interface (API) rather than direct system call use
‫ن‬x‫) بدالً م‬API( ‫توى‬x‫ة المس‬x‫بيقات عالي‬x‫ج التط‬x‫ة برام‬x‫بر واجه‬x‫ا ع‬x‫ول إليه‬x‫م الوص‬x‫ يت‬، ‫ب‬x‫ي الغال‬x‫ف‬
‫استخدام استدعاء النظام المباشر‬
 Three most common APIs are Win32 API for Windows, POSIX API for
POSIX-based systems (including virtually all versions of UNIX, Linux,
and Mac OS X), and Java API for the Java virtual machine (JVM)
‫ و‬، ‫كس‬x‫ة بوس‬x‫ لالنظم‬POSIX API ، ‫ للويندوز‬Win32 API ‫ي‬x‫ا ه‬x‫ر شيوع‬x‫ اكث‬API ‫الثالث‬
‫ للجافا‬Java API

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 13


Types of System Calls
 Process control‫لعمليات‬xx‫ا‬xxx‫ ب‬x‫لتحكم‬xx‫ا‬
• create process, terminate process ‫اء عملية‬x‫نه‬x‫نشاء او ا‬x‫ا‬
• end, abort ‫اء‬x‫لغ‬xx‫ ا‬، ‫اء‬x‫نه‬x‫ا‬
• load, execute ‫نفيذ‬xxx‫ ت‬،‫حميل‬xxx‫ت‬
• get process attributes, set process attributes ‫سناد‬x‫لحصولعلىخصائصاو ا‬xx‫ا‬
‫لعملية‬xx‫خصائصل‬
• wait for time‫لوقت‬xx‫بعضا‬xx‫النتظار ل‬xx‫ا‬
• wait event, signal event‫حدث‬xx‫النتظار ل‬xx‫ا‬
• allocate and free memory ‫كرة‬x‫لذا‬xx‫حرير ا‬xxx‫خصيصاو ت‬xxx‫ت‬
• Dump memory if error ‫الخطاء‬xx‫لة ا‬xx‫ا‬x‫يح‬xxx‫كرة ف‬x‫لذا‬xx‫ ا‬x‫فريغ‬xxx‫ت‬
• Debugger for determining bugs, single step execution‫تحديد‬xx‫ ل‬x‫لتتبع‬xx‫ا‬
‫الخطاء‬xx‫ا‬
• Locks for managing access to shared data between processes ‫ل‬xx‫قفا‬x‫أ‬
‫لعمليات‬xx‫ينا‬xxx‫لمشتركة ب‬xx‫لبياناتا‬xx‫لىا‬xx‫لوصولإ‬xx‫دارة ا‬x‫إل‬

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 14


Types of System Calls
 File management‫لملفات‬xx‫ادارة ا‬
• create file, delete file ‫لملفات‬xx‫ذفا‬x‫نشاء ح‬x‫ا‬
• open, close file ‫لملفات‬xx‫غالقا‬x‫تح او ا‬xxx‫ف‬
• read, write, reposition‫ديل‬x‫لتع‬xx‫لكتابة وا‬xx‫راءة وا‬x‫لق‬xx‫ا‬
• get and set file attributes‫لملفات‬xx‫ خصائصل‬x‫لحصولاو وضع‬xx‫ا‬
 Device management ‫زة‬x‫الجه‬xx‫ادارة ا‬
• request device, release device x‫حريره‬xxx‫از او ت‬x‫طلبجه‬
• read, write, reposition‫ديل‬x‫لتع‬xx‫راءة او ا‬x‫لق‬xx‫لكتابة او ا‬xx‫ا‬
• get device attributes, set device attributes‫عيين‬xxx‫لحصولاو ت‬xx‫ا‬
‫زة‬x‫ألجه‬xx‫خصائصل‬
• logically attach or detach devices ‫زة‬x‫ألجه‬xx‫لفصلل‬xx‫الرفاقاو ا‬xx‫ا‬
OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 15
Types of System Calls (Cont.)
 Information maintenance‫لمعلومات‬xx‫يانة ا‬xx‫ص‬
• get time or date, set time or date ‫لتاريخ‬xx‫لوقتاو ا‬xx‫عيينا‬xxx‫لحصولاو ت‬xx‫ا‬
• get system data, set system data x‫لنظام‬xx‫ياناتا‬xxx‫عيينب‬xxx‫لحصولاو ت‬xx‫ا‬
• get and set process, file, or device attributes ‫عيينخصائص‬xxx‫لحصولاو ت‬xx‫ا‬
‫زة‬x‫الجه‬xx‫ ا‬،‫لملف‬xx‫ ا‬، ‫لعملية‬xx‫ا‬
 Communications‫صل‬x‫لتوا‬xx‫ا‬
• create, delete communication connection‫ل‬xx‫التصا‬xx‫ذفا‬x‫نشاء او ح‬x‫ا‬
• send, receive messages if message passing model to host
name or process name x‫سم‬x‫لىا‬xx‫لرسائلا‬xx‫مرير ا‬xxx‫يطريقة ت‬xxx‫لرسائلف‬xx‫ ا‬x‫ستالم‬x‫لوا‬xx‫ارسا‬
‫لضيف‬xx‫لعملية او ا‬xx‫ا‬
• Shared-memory model create and gain access to memory
regions
• transfer status information ‫لة‬xx‫لحا‬xx‫لمعلوماتا‬xx‫نتقا‬x‫ا‬
• attach and detach remote devices ‫لبعيدة‬xx‫زة ا‬x‫ألجه‬xx‫إرفاقوفصلا‬
OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 16
Types of System Calls (Cont.)
 Protection ‫لحماية‬xx‫ا‬
• Control access to resources ‫لموارد‬xx‫لوصولل‬xx‫ا‬xxx‫ ب‬x‫لتحكم‬xx‫ا‬
• Get and set permissions‫الذونات‬xx‫عيينا‬xxx‫لحصولاو ت‬xx‫ا‬
• Allow and deny user access‫ وصول‬x‫لسماح او منع‬xx‫ا‬
x‫لمستخدم‬xx‫ا‬

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 17


Examples of Windows and Unix System Calls

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 18


Standard C Library Example
 C program invoking
printf() library call, which
calls write() system call
‫ من‬printf ‫ تستخدم الدالة‬C ‫لغة ال‬
‫ من‬write ‫المكتبة والتي تستدعي ال‬
‫استدعاء النظام‬

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 19


A View of Operating System Services

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 20


SYSTEM PROGRAMS

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 21


System Programs
 System programs provide a convenient environment for program
development and execution. ‫مج وتنفيذها‬x‫لبرا‬xx‫تطوير ا‬xx‫يئة مالئمة ل‬xxx‫ ب‬x‫لنظام‬xx‫مج ا‬x‫را‬xxx‫وفر ب‬xxx‫ت‬.
 They can be divided into:‫لى‬xx‫ا ا‬x‫قسيمه‬xxx‫مكنت‬xx‫ ي‬x‫لنظام‬xx‫مج ا‬x‫را‬xxx‫ب‬
• File manipulation‫لملفات‬xx‫لجة ا‬xx‫ا‬x‫مع‬
• Status information sometimes stored in a File modification ‫لة‬xx‫لحا‬xx‫معلوماتا‬
• Programming language support ‫لبرمجة‬xx‫اتا‬x‫غ‬xx‫ ل‬x‫دعم‬
• Program loading and execution ‫مج‬x‫لبرا‬xx‫حميلوتنفيذ ا‬xxx‫ت‬
• Communications‫ل‬xx‫التصا‬xx‫ا‬
• Background services ‫لخلفية‬xx‫دماتا‬x‫خ‬
• Application programs ‫لتطبيقات‬xx‫مج ا‬x‫را‬xxx‫ب‬
 Most users’ view of the operation system is defined by system
programs, not the actual system calls x‫نظام‬xx‫لمستخدمينل‬xx‫ ا‬x‫حديد رؤية معظم‬xxx‫ ت‬x‫تم‬xx‫ي‬
‫لفعلية‬xx‫ ا‬x‫لنظام‬xx‫تا‬x‫ستدعاءا‬x‫ وليسا‬، x‫لنظام‬xx‫مج ا‬x‫را‬xxx‫لب‬x‫لتشغيلمنخال‬xx‫ا‬

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 22


System Programs
 Some of System Programs are simply user interfaces to system
calls; others are considerably more complex ‫ هي‬x‫لنظام‬xx‫ ا‬x‫مج‬x‫را‬xxx‫عضب‬xxx‫ب‬
‫عقي ًدا‬xxx‫كثر ت‬x‫آلخر أ‬xx‫لبعضا‬xx‫ ؛ ا‬x‫لنظام‬xx‫تا‬x‫ستدعاءا‬x‫ ال‬x‫لمستخدم‬xx‫اتا‬x‫جه‬x‫بساطة وا‬xxx‫ب‬
 File management - Create, delete, copy, rename, print, dump, list,
and generally manipulate files and directories
 Status information
• Some ask the system for info - date, time, amount of available
memory, disk space, number of users-‫ معلومات‬x‫لنظام‬xx‫لبعضمنا‬xx‫طلبا‬xx‫ي‬
‫لمستخدمين‬xx‫لقرصوعدد ا‬xx‫لمتوفرة ومساحة ا‬xx‫كرة ا‬x‫لذا‬xx‫لوقتومقدار ا‬xx‫لتاريخ وا‬xx‫ا‬
• Others provide detailed performance, logging, and debugging
information ‫ألخطاء‬xx‫لتسجيلوتصحيح ا‬xx‫ألداء وا‬xx‫آلخر معلوماتمفصلة عنا‬xx‫لبعضا‬xx‫وفر ا‬xx‫ي‬
• Typically, these programs format and print the output to the
terminal or other output devices ‫تنسيقوطباعة‬xxx‫ ب‬x‫مج‬x‫لبرا‬xx‫ ا‬x‫ هذه‬x‫وم‬x‫ق‬xxx‫ادةً ما ت‬x‫ع‬
‫ألخرى‬xx‫ج ا‬x‫إلخرا‬xx‫زة ا‬x‫جه‬x‫از أو أ‬x‫لجه‬xx‫لىا‬xx‫ج إ‬x‫إلخرا‬xx‫ا‬

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 23


System Programs (Cont.)
 File modification
• Text editors to create and modify files ‫نشاء‬x‫لنصوصإل‬xx‫حرير ا‬xxx‫مج ت‬x‫را‬xxx‫ب‬
‫لملفات‬xx‫ديلا‬x‫وتع‬
• Special commands to search contents of files or perform
transformations of the text ‫جراء‬x‫لملفاتأو إ‬xx‫يمحتوياتا‬xxx‫لبحثف‬xx‫اصة ل‬x‫مر خ‬x‫أوا‬
‫لنص‬xx‫حويالتعلىا‬xxx‫ت‬
 Programming-language support - Compilers, assemblers,
debuggers and interpreters sometimes provided ، x‫لمترجم‬xx‫وفير ا‬xxx‫ ت‬x‫تم‬xx‫ي‬
‫لمفسر‬xx‫ ا‬، x‫لمتتبع‬xx‫ ا‬، x‫لمجمع‬xx‫ا‬
 Program loading and execution- Absolute loaders, relocatable
loaders, linkage editors, and overlay-loaders, debugging systems
for higher-level and machine language ،‫لنقل‬xx‫لقابلة ل‬xx‫لمحملا‬xx‫ ا‬، ‫لمطلقة‬xx‫لمحملا‬xx‫ا‬
‫آللة‬xx‫ة ا‬x‫ألعلىولغ‬xx‫لمستوىا‬xx‫لتصحيح ل‬xx‫نظمة ا‬x‫ وأ‬، ‫كبة‬x‫لمترا‬xx‫لمحملا‬xx‫ وا‬، ‫لربط‬xx‫تا‬x‫ومحررا‬

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 24


System Programs (Cont.)
 Communications - Provide the mechanism for creating virtual
connections among processes, users, and computer systems ‫ر‬x‫وفي‬xxx‫ت‬
‫لكمبيوتر‬xx‫نظمة ا‬x‫لمستخدمينوأ‬xx‫لعملياتوا‬xx‫ينا‬xxx‫ضية ب‬x‫الفترا‬xx‫التا‬xx‫التصا‬xx‫نشاء ا‬x‫لية إ‬xx‫آ‬
• Allow users to send messages to one another’s screens, browse
web pages, send electronic-mail messages, log in remotely,
transfer files from one machine to another ‫تخدمين‬x‫لمس‬xx‫ماح ل‬x‫لس‬xx‫ا‬
‫ل‬xx‫ا‬x‫ وإرس‬،‫ب‬x‫لوي‬xx‫فحاتا‬xx‫فح ص‬x‫ وتص‬،‫ض‬x‫لبع‬xx‫ ا‬x‫م‬x‫عضه‬xxx‫اشاتب‬xx‫لىش‬xx‫ائلإ‬x‫لرس‬xx‫لا‬xx‫ا‬x‫إرس‬xxx‫ب‬
‫خر‬x‫لىآ‬xx‫از إ‬x‫اتمنجه‬x‫لملف‬xx‫ ونقلا‬، ‫د‬x‫ع‬xxx‫لدخولعن ُب‬xx‫ وتسجيلا‬،‫لكتروني‬x‫إل‬xx‫لبريد ا‬xx‫رسائلا‬

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 25


System Programs (Cont.)
 Background Services
• Launch at boot time ‫القالع‬xx‫طلقوقتا‬xxx‫ت‬
• Some for system startup, then terminate x‫م‬xxx‫ ث‬، x‫لنظام‬xx‫شغيلا‬xxx‫بدء ت‬xx‫ا ل‬x‫عضه‬xxx‫ب‬
‫نتهي‬xxx‫ت‬
• Some from system boot to shutdown ‫طفاء‬x‫ وحتىا‬،‫القالع‬xx‫ا منذ ا‬x‫عضه‬xxx‫ب‬
‫از‬x‫لجه‬xx‫ا‬
• Provide facilities like disk checking, process scheduling, error
logging, printing ‫ألخطاء‬xx‫لعملياتوتسجيلا‬xx‫لقرصوجدولة ا‬xx‫حصا‬xxx‫سهيالتمثلف‬xxx‫وفير ت‬xxx‫ت‬
‫لطباعة‬xx‫وا‬
• Run in user context not kernel context ‫لنواة‬xx‫ وليسا‬x‫لمستخدم‬xx‫ياقا‬xx‫يس‬xxx‫شتغلف‬xxx‫ت‬
• Known as services, subsystems ‫لفرعية‬xx‫النظمة ا‬xx‫لخدماتاو ا‬xx‫ ا‬x‫اسم‬xxx‫رفب‬x‫ع‬xxx‫ت‬
 Application programs

• Don’t pertain to system x‫لنظام‬xx‫ا‬xxx‫تعلقب‬xxx‫ ت‬x‫ال‬


• Run by users x‫لمستخدم‬xx‫سطة ا‬x‫وا‬xxx‫ذ ب‬x‫نف‬xxx‫ت‬
• Not typically considered part of OS‫لتشغيل‬xx‫ ا‬x‫ظام‬xx‫ز ًءا منن‬x‫ادةً ج‬x‫عتبر ع‬xxx‫ ت‬x‫ال‬
• Launched
OPERATING SYSTEMS– AL-NASSER
by command line,UNIVERSITY 02/26/2022
mouse click, finger poke‫ عن‬x‫شغيله‬xxx‫ت‬ x‫تم‬xx‫ي‬ 26
OPERATING SYSTEM DESIGN
AND IMPLEMENTATION

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 27


Operating System Design and
Implementation
 Design and Implementation of OS not “solvable”, but
some approaches have proven successful ‫ذ‬xx‫ وتنفي‬x‫ميم‬xx‫ص‬xxx‫ت‬
‫ا‬x‫جاحه‬xx‫ليبن‬xx‫ألسا‬xx‫عضا‬xxx‫ثبتتب‬x‫ ولكنأ‬، "‫لحل‬xx‫ابلل‬xx‫لتشغيلغير "ق‬xx‫ ا‬x‫ظام‬xx‫ن‬
 Internal structure of different Operating Systems can
vary widely‫ى‬x‫ة عل‬x‫لمختلف‬xx‫لا‬x‫لتشغي‬xx‫ة ا‬x‫نظم‬x‫يأل‬x‫خل‬x‫لدا‬xx‫لا‬x‫لهيك‬xx‫فا‬x‫ختل‬xx‫ني‬x‫نأ‬x‫مك‬xx‫ي‬
x‫سع‬x‫طاقوا‬xx‫ن‬
 Start the design by defining goals and specifications ‫بدأ‬x‫ا‬
‫صفات‬x‫لموا‬xx‫فوا‬x‫ألهدا‬xx‫تحديد ا‬xxx‫ ب‬x‫لتصميم‬xx‫ا‬
 The Design is affected by choice of hardware, type of
system x‫لنظام‬xx‫لمادية ونوع ا‬xx‫لمكوناتا‬xx‫اختيار ا‬xxx‫ ب‬x‫لتصميم‬xx‫تأثر ا‬xx‫ي‬

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 28


Operating System Design and
Implementation
 User goals and System goals
• User goals – operating system should be convenient to
use, easy to learn, reliable, safe, and fast‫ب‬x‫ج‬xx‫ ي‬- x‫تخدم‬x‫س‬x‫لم‬xx‫فا‬x‫هدا‬x‫أ‬
‫ا‬x‫وسريع‬
ً ‫منًا‬x‫ وموثوقًا وآ‬x‫لتعلم‬xx‫ وسهلا‬x‫م‬x‫الستخدا‬xx‫لتشغيلمناسبًا ل‬xx‫ ا‬x‫ظام‬xx‫كونن‬xx‫ني‬x‫أ‬
• System goals – operating system should be easy to design,
implement, and maintain, as well as flexible, reliable,
error-free, and efficient ‫ل‬x‫ي‬x‫لتشغ‬xx‫ ا‬x‫ظام‬xx‫ونن‬x‫ك‬xx‫ني‬x‫بأ‬x‫ج‬xx‫ ي‬- x‫لنظام‬xx‫فا‬x‫هدا‬x‫أ‬
‫ة‬xx‫وثوقي‬x‫لم‬xx‫ة وا‬xx‫لمرون‬xx‫ىا‬x‫ل‬xx‫ة إ‬xx‫إلضاف‬xx‫ا‬xxx‫ ب‬، ‫يانة‬xx‫لص‬xx‫ذ وا‬xx‫لتنفي‬xx‫ وا‬x‫ميم‬xx‫لتص‬xx‫هلا‬xxx‫س‬
‫لية‬xx‫ا‬x‫لفع‬xx‫ألخطاء وا‬xx‫ليمنا‬xx‫وخا‬

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 29


Implementation
 Much variation ‫بير‬x‫ختالفك‬x‫ا‬
• Early OSes in assembly language x‫لتجميع‬xx‫ة ا‬x‫غ‬xx‫يل‬xxx‫لمبكرة هيف‬xx‫لتشغيلا‬xx‫نظمة ا‬x‫أ‬
• Then system programming languages like Algol, PL/1 (The first system)
• Now C, C++
 Actually usually a mix of languages‫ات‬x‫للغ‬xx‫ هيمزيج منا‬x‫قع‬x‫لوا‬xx‫يا‬xxx‫ف‬
• Lowest levels in assembly x‫لتجميع‬xx‫ة ا‬x‫لغ‬xxx‫ألدنىب‬xx‫لمستوياتا‬xx‫ا‬
• Main body in C‫لسي‬xx‫ة ا‬x‫لغ‬xxx‫لرئيسيب‬xx‫ ا‬x‫لجسم‬xx‫ا‬
• Systems programs in C, C++, scripting languages like PERL, Python, shell
scripts‫لبايثون‬xx‫لبيرلوا‬xx‫لنصية مثلا‬xx‫لبرمجة ا‬xx‫اتا‬x‫السولغ‬xxx‫لسيب‬xx‫لسيوا‬xx‫اتا‬x‫لغ‬xxx‫ألنظمة ب‬xx‫مج ا‬x‫را‬xxx‫ب‬
 Emulation (Virtualization) can allow an OS to run on non-native hardware
‫صلية‬x‫زة غير أ‬x‫جه‬x‫لعملعلىأ‬xx‫ا‬xxx‫لتشغيلب‬xx‫ ا‬x‫نظام‬xx‫لسماح ل‬xx‫مكنا‬xxx‫ ت‬: ‫لمحاكاة‬xx‫ا‬
 Emulators are programs that duplicate the functionality of one system on
another system ‫خر‬x‫ آ‬x‫ظام‬xx‫ ما علىن‬x‫ظام‬xx‫وظائف‬ ‫ن‬ ‫كرر‬xxx‫مج ت‬x‫را‬xxx‫لمحاكياتهيب‬xx‫ا‬

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 30


OPERATING SYSTEM
STRUCTURE

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 31


Operating System Structure
 General-purpose OS is very large program ‫ل‬xxx‫لتشغي‬xx‫ ا‬x‫ظام‬xx‫ن‬
‫ ًدا‬x‫بير ج‬xx‫ج ك‬x‫رنام‬xxx‫امة هو ب‬x‫لع‬xx‫ضا‬x‫ألغرا‬xx‫ل‬
 A common approach is to partition the task into small
components, or modules, rather than have one monolithic
system.،‫ت‬x‫و وحدا‬x‫ أ‬، ‫غيرة‬xx‫وناتص‬x‫لىمك‬xx‫ة إ‬x‫لمهم‬xx‫ ا‬x‫يم‬x‫قس‬xxx‫يت‬x‫ة ه‬xx‫لشائع‬xx‫ة ا‬x‫لطريق‬xx‫ا‬
ً
‫بط‬x‫حد مترا‬x‫ وا‬x‫ظام‬xx‫ا ن‬x‫ه‬x ‫ونل‬x‫ك‬xx‫ني‬x‫دال منأ‬xxx‫ب‬.
 Various ways to structure ones ‫ة‬x‫طرقمختلف‬
• Simple structure – MS-DOS ‫سيطة‬xxx‫هيكلية ب‬
• More complex – UNIX ‫هيكلية معقدة‬
• Layered –‫طبقات‬
• Microkernel –Mach ‫لصغيرة‬xx‫لنواة ا‬xx‫ا‬
OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 32
Simple Structure -- MS-DOS
 MS-DOS was written in Intel 8088
assembly language. ‫لدوس‬xx‫ة ا‬xxx‫تاب‬x‫تك‬xx‫م‬xxx‫ت‬
x‫لتجميع‬xx‫ة ا‬x‫لغ‬xxx‫ب‬
 MS-DOS – written to provide the
most functionality in the least space
‫ل‬x‫ق‬x‫يأ‬xxx‫فف‬x‫لوظائ‬xx‫در منا‬xx‫بر ق‬x‫ك‬x‫ر أ‬x‫توفي‬xx‫مكتوب‬
‫ل‬ ‫لدوس‬xx‫ا‬
‫مساحة‬
• Not divided into modules ‫ر‬xx‫غي‬
‫ت‬x‫لىوحدا‬xx‫مقسمة إ‬
• Although MS-DOS has some
structure, its interfaces and levels
of functionality are not well
separated‫ة‬x‫ني‬xxx‫ ب‬x‫ه‬xx‫لدوس ل‬xx‫نا‬x‫ منأ‬x‫لرغم‬xx‫ىا‬x‫عل‬
‫ت‬x‫يس‬xx‫ ل‬x‫ه‬x‫توياتوظيفت‬x‫ ومس‬x‫ه‬x‫ات‬x‫جه‬x‫نوا‬x‫الأ‬xx‫ إ‬، ‫ا‬x‫م‬
‫منفصلة جي ًدا‬
OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 33
Non Simple Structure -- UNIX
 UNIX – limited by hardware functionality, the original UNIX
operating system had limited structuring.
 The UNIX OS consists of two separable parts‫زئيين‬x‫لىج‬xx‫ ا‬x‫نقسم‬xx‫ي‬
‫منفصلين‬
• Systems programsx‫لنظام‬xx‫مج ا‬x‫را‬xxx‫ب‬
• The kernel‫لنواة‬xx‫ا‬
• Consists of everything below the system-call interface
and above the physical hardware ‫ة‬x‫جه‬x‫سفلوا‬x‫يء أ‬x ‫لش‬x‫تكونمنك‬xx‫ي‬
‫لمادية‬xx‫زة ا‬x‫ألجه‬xx‫ وفوقا‬x‫لنظام‬xx‫ستدعاء ا‬x‫ا‬
• Provides the file system, CPU scheduling, memory
management, and other operating-system functions.
‫كرة ووظائف‬x‫لذا‬xx‫لمركزية وإدارة ا‬xx‫لجة ا‬xx‫ا‬x‫لمع‬xx‫لملفاتوجدولة وحدة ا‬xx‫ ا‬x‫ظام‬xx‫وفر ن‬xx‫ي‬
‫ألخرى‬xx‫لتشغيلا‬xx‫ ا‬x‫ظام‬xx‫ن‬
OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 34
Traditional UNIX System Structure

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 35


Layered Approach
 The operating system is divided into a number of layers
(levels), each built on top of lower layers.‫لى‬xx‫لتشغيلإ‬xx‫ ا‬x‫ظام‬xx‫ ن‬x‫نقسم‬xx‫ي‬
‫لسفلية‬xx‫لطبقاتا‬xx‫وقا‬xxx‫ا مبنيف‬x‫لمنه‬x‫ ك‬، ‫مستويات‬
) ‫ل‬xx‫لطبقات(ا‬xx‫دد منا‬x‫ع‬
 The bottom layer (layer 0), is the hardware; the highest
(layer N) is the user interface.‫ألعلىهي‬xx‫لماديوا‬xx‫لعتاد ا‬xx‫لسفلية هيا‬xx‫لطبقة ا‬xx‫ا‬
x‫لمستخدم‬xx‫ة ا‬x‫جه‬x‫وا‬
 layers are selected such that each uses functions
(operations) and services of only lower-level layers ‫حديد‬xxx‫ ت‬x‫تم‬xx‫ي‬
‫قط‬xxx‫ألدنىف‬xx‫لمستوىا‬xx‫اتا‬x‫طبق‬xx‫ت‬
‫وظائفعملياتوخدما ل‬
) ( ‫ا‬x‫لمنه‬x‫ ك‬x‫ستخدم‬xx‫حيثي‬xxx‫اتب‬x‫لطبق‬xx‫ا‬
 The major difficulty with the layered approach involves
appropriately defining the various layers. ‫لرئيسية‬xx‫وبة ا‬x‫لصع‬xx‫تضمنا‬xxx‫ت‬
‫شكلمناسب‬xxx‫لمختلفة ب‬xx‫اتا‬x‫لطبق‬xx‫ريفا‬x‫ع‬xxx‫اتهو ت‬x‫لطبق‬xx‫هج ا‬xx‫ين‬xxx‫ف‬.

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 36


Layered Approach

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 37


Microkernel System Structure
 as UNIX expanded, the kernel became large and difficult to manage. ‫س‬x‫لونك‬xx‫ ا‬x‫ع‬x‫وس‬xxx‫ ت‬x‫ع‬x‫م‬
‫إلدارة‬xx‫بيرة وصعبة ا‬x‫لنواة ك‬xx‫صبحتا‬x‫أ‬.
 In the mid-1980s, researchers developed an operating system called Mach that
modularized the kernel using the microkernel approach.
‫ج‬x‫تخدام نه‬x‫ط النواة باس‬x‫ والذي نم‬Mach ‫مى‬x‫ل يس‬x‫ طور الباحثون نظام تشغي‬، ‫ي‬x‫ن القرن الماض‬x‫ف الثمانينيات م‬x‫ي منتص‬x‫ف‬
.microkernel
 This method structures the operating system by removing all nonessential components
from the kernel and implementing them as system and user-level programs.
‫ى‬x‫برامج عل‬x‫ا ك‬x‫ن النواة وتنفيذه‬x‫اسية م‬x‫ر األس‬x‫ع المكونات غي‬x‫ة جمي‬x‫ق إزال‬x‫ن طري‬x‫ل ع‬x‫ة ببناء نظام التشغي‬x‫تقوم هذه الطريق‬
.‫مستوى النظام والمستخدم‬
 The main function of the microkernel is to provide communication between the client
program and the various services that are also running in user space.
‫ي‬x‫ا ف‬x‫ض‬
ً ‫ل أي‬x‫ي تعم‬x‫ة الت‬x‫ل والخدمات المختلف‬x‫ج العمي‬x‫ن برنام‬x‫ال بي‬x‫ر االتص‬x‫ي توفي‬x‫ ف‬microkernel ‫ية لـ‬x‫ة الرئيس‬x‫ل الوظيف‬x‫تتمث‬
.‫مساحة المستخدم‬
 Communication takes place using message passing ‫لرسائل‬xx‫مرير ا‬xxx‫ ت‬x‫م‬x‫استخدا‬xxx‫لب‬xx‫التصا‬xx‫ ا‬x‫تم‬xx‫ي‬

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 38


Microkernel System Structure

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 39


Microkernel System Structure
 Benefits: ‫ئد‬x‫لفوا‬xx‫ا‬
• Easier to extend a microkernel ‫واة‬xx‫تمديد ن‬xx‫سهلل‬x‫أ‬
• Easier to port the operating system to new architectures‫ل‬x‫ق‬x ‫ين‬xxx‫هلف‬x‫س‬x‫أ‬
‫لجديدة‬xx‫لبنىا‬xx‫لىا‬xx‫لتشغيلإ‬xx‫ ا‬x‫ظام‬xx‫ن‬
• More reliable (less code is running in kernel mode)‫ة‬xx‫ر موثوقي‬xx‫كث‬x‫أ‬
‫لنواة‬xx‫ ا‬x‫يوضع‬xxx‫قلف‬x‫ود أ‬x‫شغيلك‬xxx‫ت‬
• More secure ‫منا‬x‫كثر ا‬x‫ا‬
 Detriments: ‫الضرار‬xx‫ا‬
• Performance overhead of user space to kernel space
communication ‫لنواة‬xx‫ ومساحة ا‬x‫لمستخدم‬xx‫ينمساحة ا‬xxx‫صلب‬x‫لتوا‬xx‫ب اداء ا‬
‫عء‬
• Example: Windows NT

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 40


Hybrid Systems
 Most modern operating systems are actually not one pure
model ‫لصًا‬xx‫ا‬x‫ح ًدا خ‬x‫موذجًا وا‬xx‫ ن‬x‫قع‬x‫لوا‬xx‫يا‬xxx‫يستف‬xx‫لحديثة ل‬xx‫لتشغيلا‬xx‫نظمة ا‬x‫ أ‬x‫معظم‬
• Hybrid combines multiple approaches to address
performance, security, usability needs‫ددة‬x‫ينطرقمتع‬xxx‫ ب‬x‫جمع‬xx‫ي‬
x‫م‬x‫الستخدا‬xx‫ألمانوقابلية ا‬xx‫ألداء وا‬xx‫حتياجاتا‬x‫لجة ا‬xx‫ا‬x‫مع‬xx‫ل‬
• Linux kernel is monolithic, plus modular for dynamic
loading of functionality‫ت‬x‫لىوحدا‬xx‫إلضافة ا‬xx‫ا‬xxx‫للينكسمتجانسة ب‬xx‫واة ا‬xx‫ن‬
‫لوظائف‬xx‫لديناميكيل‬xx‫لتحميلا‬xx‫ل‬
• Windows mostly monolithic, plus microkernel for
different subsystem personalities.‫لبمتجانس‬xx‫ا‬x‫لغ‬xx‫يا‬xxx‫لويندوز ف‬xx‫ا‬
‫رعية مختلفة‬xxx‫نظمة ف‬x‫ة أل‬x‫لدقيق‬xx‫لنواة ا‬xx‫تا‬x‫لىوحدا‬xx‫إلضافة ا‬xx‫ا‬xxx‫ب‬

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 41


OPERATING-SYSTEM
DEBUGGING

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 42


Operating-System Debugging
 Debugging is finding and fixing errors, or bugs ‫ا‬x‫صالحه‬x‫الخطاء وا‬xx‫لبحثعنا‬xx‫ هو ا‬x‫لتتبع‬xx‫ا‬
 OS generate log files containing error information‫إنشاء ملفات‬xxx‫ ب‬x‫قوم‬xx‫لي‬x‫لتشغي‬xx‫ ا‬x‫ظام‬xx‫ن‬
‫الخطاء‬xx‫حتويعلىمعلوماتا‬xxx‫ت‬
 Failure of an application can generate core dump file capturing memory of the
process ‫لعملي‬xx‫كرة ا‬x‫ذا‬xx‫ساسيل‬x‫ أ‬x‫فريغ‬xxx‫نشاء ملفت‬x‫لىإ‬xx‫ؤديإ‬xx‫لتطبيقاتي‬xx‫حد ا‬x‫شلأ‬xxx‫ف‬
 Operating system failure can generate crash dump file containing kernel
memory ‫لنواة‬xx‫كرة ا‬x‫حتوىذا‬xx‫لعطلي‬xx‫نشاء ملفا‬x‫لىإ‬xx‫ؤديإ‬xx‫لتشغيل ي‬xx‫ ا‬x‫ظام‬xx‫شلن‬xxx‫ف‬
 Beyond crashes, performance tuning can optimize system performance ‫عي ًدا عن‬xxx‫ب‬
x‫لنظام‬xx‫حسينأداء ا‬xxx‫ألداء ت‬xx‫ضبط ا‬xx‫مكنل‬xx‫ ي‬،‫ل‬xx‫ألعطا‬xx‫ا‬
• Sometimes using trace listings of activities, recorded for analysis‫ض‬x‫ع‬xxx‫يب‬xxx‫ف‬
‫لتحليل‬xx‫لمسجلة ل‬xx‫ ا‬، ‫ألنشطة‬xx‫ ل‬x‫لتتبع‬xx‫ ا‬x‫ئم‬x‫وا‬xx‫ ق‬x‫م‬x‫استخدا‬xxx‫ألحيانب‬xx‫ا‬
• Profiling is periodic sampling of instruction pointer to look for statistical
trends ‫إلحصائية‬xx‫التجاهاتا‬xx‫لبحثعنا‬xx‫لتعليماتل‬xx‫مؤشر ا‬xx‫خذ عيناتدورية ل‬x‫لتوصيفهو أ‬xx‫ا‬

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 43


Operating-System Debugging
 Control Panel\System and Security\Administrative Tools - event viewer

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 44


Performance Tuning
 Improve performance by
removing bottlenecks ‫ألداء‬xx‫ينا‬x‫حس‬xxx‫ت‬
‫الختناقات‬xx‫لة ا‬xx‫عنطريقإزا‬
 OS must provide means of
computing and displaying
measures of system behavior‫ب‬x‫ج‬xx‫ي‬
‫اب‬xxx‫حس‬xx‫ائلل‬xxx‫لوس‬xxx‫لتشغي‬xx‫ ا‬x‫ظام‬xx‫ر ن‬xxx‫وف‬xx‫ني‬xxx‫أ‬
x‫لنظام‬xx‫لوك ا‬xx‫وعرضمقاييسس‬
 For example, Windows Task
Manager

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 45


The End

OPERATING SYSTEMS– AL-NASSER UNIVERSITY 02/26/2022 46

You might also like