EN عربي1 · اقرأ: العبارة الإنجليزية من المقرر، ثم ترجمتها العربية تحتها.
2 · افهم: اضغط أي أيقونة عليها مصباح ليظهر شرحها. وأيقونة العنوان تشرح القسم كاملاً.
وضّح لي أكثرما زالت غامضة؟ اضغط «وضّح لي أكثر» لترى مثالاً من الواقع.
ROMمصطلح جديد؟ الكلمات المنقّطة تشرح نفسها.
3 · جاهز؟ اختبر نفسك في نهاية كل قسم، وتأكد أنك فهمت.
يمكنك فتح هذه التعليمات مرة أخرى من زر ? أعلى الصفحة
ملخص نظم التشغيل
Chapter 2: Operating-System Structures
قبل أن تبدأ · ماذا ستتعلم في هذا الفصل؟
أهداف الفصل
Objectives
وصف الخدمات التي يقدّمها نظام التشغيل للمستخدمين والعمليات والأنظمة الأخرى.
To describe the services an operating system provides to users, processes, and other systems.
سنتعرّف على ما يقدّمه نظام التشغيل: مثل تشغيل البرامج وإدارة الملفات والحماية.
مناقشة الطرق المختلفة لهيكلة نظام التشغيل.
To discuss the various ways of structuring an operating system.
أي كيف تُنظَّم أجزاء نظام التشغيل داخلياً.
شرح كيف يُثبَّت نظام التشغيل ويُخصَّص، وكيف يقلع.
To explain how operating systems are installed and customized and how they boot.
من التثبيت حتى بدء التشغيل.
خدمات نظام التشغيل
أنظمة التشغيل توفّر بيئة لتنفيذ البرامج، وخدمات للبرامج والمستخدمين.
Operating System Services
Operating systems provide an environment for execution of programs and services to programs and users.
نظام التشغيل يوفّر بيئة لتشغيل البرامج، ويقدّم خدمات للبرامج والمستخدمين.
والخدمات نوعان: نوع يساعد المستخدم (واجهة الاستخدام، تشغيل البرامج، الإدخال والإخراج، الملفات، الاتصالات، اكتشاف الأخطاء)، ونوع يضمن كفاءة عمل النظام نفسه (توزيع الموارد، المحاسبة، الحماية والأمان).
خدمات مفيدة للمستخدم
One set of OS services provides functions that are helpful to the user
واجهة المستخدم: تقريباً كل أنظمة التشغيل لها واجهة، وتتنوع بين: نصية (CLI)، رسومية (GUI)، دفعية (Batch).
User interface – Almost all operating systems have a user interface (UI). Varies between Command-Line (CLI), Graphics User Interface (GUI), Batch.
الواجهة هي طريقة تعامل المستخدم مع النظام: بكتابة أوامر نصية (CLI)، أو بالأيقونات والفأرة (GUI)، أو بإرسال مجموعة أوامر في ملف تُنفَّذ دفعة واحدة (Batch).
وضّح لي أكثر
مثال: موجّه الأوامر في Windows واجهة نصية، وسطح المكتب واجهة رسومية.
تنفيذ البرامج: يجب أن يستطيع النظام تحميل البرنامج إلى الذاكرة وتشغيله وإنهاءه، بشكل طبيعي أو غير طبيعي (بخطأ).
Program execution – The system must be able to load a program into memory and to run that program, end execution, either normally or abnormally (indicating error).
نظام التشغيل يحمّل البرنامج من القرص إلى الذاكرة، يشغّله، ثم ينهيه: إما بشكل طبيعي عند انتهاء عمله، أو بشكل غير طبيعي إذا حدث خطأ.
وضّح لي أكثر
مثال: برنامج يُغلق فجأة مع رسالة خطأ، هذا إنهاء غير طبيعي.
عمليات الإدخال والإخراج: البرنامج أثناء عمله قد يحتاج إدخالاً أو إخراجاً، من ملف أو من جهاز.
I/O operations – A running program may require I/O, which may involve a file or an I/O device.
البرامج لا تتعامل مع الأجهزة مباشرة، بل تطلب من نظام التشغيل أن يقرأ أو يكتب نيابةً عنها.
وضّح لي أكثر
مثال: برنامج يطبع مستنداً على الطابعة.
إدارة نظام الملفات: البرامج تحتاج قراءة وكتابة الملفات والمجلدات، وإنشاءها وحذفها، والبحث فيها، وعرض معلوماتها، وإدارة الصلاحيات.
File-system manipulation – Programs need to read and write files and directories, create and delete them, search them, list file information, permission management.
كل ما يخص الملفات والمجلدات يتم عن طريق نظام التشغيل، ومنها الصلاحيات: من يحق له قراءة الملف أو تعديله.
وضّح لي أكثر
مثال: إنشاء مجلد جديد، أو حذف ملف، أو البحث عن ملف في الجهاز.
اختبر نفسك
1Which user interface type is NOT mentioned as a variation of OS user interfaces?
a) Command-Line (CLI) · b) Graphics User Interface (GUI) · c) Batch · d) Voice-only interface
الإجابة
d) Voice-only interface: الأنواع المذكورة: CLI و GUI و Batch.
2Loading a program into memory and running it is the service called:
a) I/O operations · b) Program execution · c) Accounting · d) Error detection
الإجابة
b) Program execution: تنفيذ البرامج.
3Reading, writing, creating, deleting and searching files and directories belongs to:
a) File-system manipulation · b) Communications · c) Resource allocation · d) User interface
الإجابة
a) File-system manipulation: إدارة نظام الملفات.
4Almost all operating systems have a user interface (UI). (True / False)
الإجابة
True: تقريباً كل أنظمة التشغيل لها واجهة.
5A program can only end execution normally, never abnormally. (True / False)
الإجابة
False: قد ينتهي بشكل طبيعي أو غير طبيعي (بخطأ).
خدمات نظام التشغيل (تابع)
Operating System Services (Cont.)
بقية الخدمات التي تساعد المستخدم: الاتصالات بين العمليات، واكتشاف الأخطاء ومعالجتها.
الاتصالات: العمليات قد تتبادل المعلومات على نفس الحاسب أو بين حواسيب عبر الشبكة، عن طريق أو (حزم ينقلها نظام التشغيل).
Communications – Processes may exchange information, on the same computer or between computers over a network. Communications may be via or through (packets moved by the OS).
طريقتان للتواصل بين العمليات: الذاكرة المشتركة حيث تقرأ العمليتان وتكتبان في نفس المنطقة، وتمرير الرسائل حيث ينقل نظام التشغيل الرسائل بينهما.
وضّح لي أكثر
مثال: تطبيق محادثة يرسل رسالتك إلى جهاز صديقك عبر الشبكة.
اكتشاف الأخطاء: نظام التشغيل يجب أن يكون منتبهاً دائماً للأخطاء الممكنة، في المعالج والذاكرة، أو في أجهزة الإدخال والإخراج، أو في برنامج المستخدم. ولكل نوع خطأ إجراء مناسب لضمان حوسبة صحيحة ومتسقة. وأدوات تصحيح الأخطاء (Debugging) تساعد المستخدم والمبرمج على استخدام النظام بكفاءة.
Error detection – OS needs to be constantly aware of possible errors. May occur in the CPU and memory hardware, in I/O devices, in user program. For each type of error, OS should take the appropriate action to ensure correct and consistent computing. Debugging facilities can greatly enhance the user's and programmer's abilities to efficiently use the system.
نظام التشغيل يراقب باستمرار، وعند حدوث خطأ يتخذ الإجراء المناسب حسب نوعه، حتى تبقى النتائج صحيحة.
وضّح لي أكثر
مثال: الطابعة نفد منها الورق، فيظهر لك تنبيه بدل أن يتوقف الجهاز.
اختبر نفسك
1Communications between processes may be via shared memory or through:
a) Message passing · b) Accounting · c) Caching · d) Bootstrap
الإجابة
a) Message passing: تمرير الرسائل.
2Errors may occur in:
a) The CPU and memory hardware only · b) I/O devices only · c) CPU and memory hardware, I/O devices, and user programs · d) User programs only
الإجابة
c) CPU and memory hardware, I/O devices, and user programs: في كل هذه الأماكن.
3Processes may exchange information on the same computer or between computers over a network. (True / False)
الإجابة
True: على نفس الجهاز أو عبر الشبكة.
4For each type of error, the OS should ignore it to keep the system fast. (True / False)
الإجابة
False: يجب أن يتخذ الإجراء المناسب.
خدمات نظام التشغيل (تابع)
مجموعة أخرى من الوظائف لضمان كفاءة عمل النظام نفسه عن طريق مشاركة الموارد.
Operating System Services (Cont.)
Another set of OS functions exists for ensuring the efficient operation of the system itself via resource sharing.
هذه الخدمات لا تخدم المستخدم مباشرة، بل تضمن كفاءة عمل النظام عند وجود عدة مستخدمين أو مهام تتشارك الموارد.
توزيع الموارد: عند وجود عدة مستخدمين أو مهام تعمل في نفس الوقت، يجب توزيع الموارد عليهم. والموارد أنواع: بعضها (مثل دورات المعالج والذاكرة الرئيسية وتخزين الملفات) له كود توزيع خاص، وبعضها (مثل أجهزة الإدخال والإخراج) له كود عام للطلب والتحرير.
Resource allocation – When multiple users or multiple jobs running concurrently, resources must be allocated to each of them. Many types of resources – Some (such as CPU cycles, main memory, and file storage) may have special allocation code, others (such as I/O devices) may have general request and release code.
الموارد المهمة مثل المعالج والذاكرة لها طريقة توزيع خاصة، أما الأجهزة فتُطلب ثم تُحرَّر بطريقة عامة.
وضّح لي أكثر
مثال: الطابعة: البرنامج يطلبها، يستخدمها، ثم يحرّرها لغيره.
المحاسبة: تتبّع أي المستخدمين يستخدم الموارد، وكم يستخدم، وما نوعها.
Accounting – To keep track of which users use how much and what kinds of computer resources.
تسجيل استهلاك كل مستخدم للموارد.
وضّح لي أكثر
مثال: جامعة تحدد لكل طالب مساحة تخزين معيّنة على الخادم.
الحماية والأمان: أصحاب المعلومات في نظام متعدد المستخدمين أو متصل بشبكة يريدون التحكم في استخدامها، والعمليات التي تعمل معاً يجب ألا تتداخل مع بعضها.
Protection and security – The owners of information stored in a multiuser or networked computer system may want to control use of that information, concurrent processes should not interfere with each other.
كل مستخدم يتحكم في بياناته، وكل عملية تعمل في مساحتها دون أن تؤثر على غيرها.
الحماية
Protection
Protection involves ensuring that all access to system resources is controlled.
الحماية تعني التأكد من أن كل وصول لموارد النظام متحكَّم فيه.
تتعلق بما يحدث داخل النظام: من يصل إلى ماذا.
وضّح لي أكثر
مثال: مستخدم لا يستطيع فتح ملفات مستخدم آخر.
الأمان
Security
Security of the system from outsiders requires user , extends to defending external I/O devices from invalid access attempts.
أمان النظام من الخارج يتطلب ، ويشمل حماية أجهزة الإدخال والإخراج الخارجية من محاولات الوصول غير المصرّح بها.
يتعلق بالحماية من الخارج: منع الدخلاء.
وضّح لي أكثر
مثال: كلمة المرور عند تسجيل الدخول.
لكي يكون النظام محمياً وآمناً، يجب وضع الاحتياطات في كل أجزائه. فالسلسلة قوتها بقوة أضعف حلقة فيها.
If a system is to be protected and secure, precautions must be instituted throughout it. A chain is only as strong as its weakest link.
اختبر نفسك
1Keeping track of which users use how much and what kinds of computer resources is:
a) Protection · b) Accounting · c) Resource allocation · d) Security
الإجابة
b) Accounting: المحاسبة.
2Security of the system from outsiders requires:
a) Caching · b) User authentication · c) DMA · d) Batch
الإجابة
b) User authentication: التحقق من هوية المستخدم.
3Ensuring that all access to system resources is controlled is called:
a) Protection · b) Accounting · c) Communication · d) Error detection
الإجابة
a) Protection: الحماية.
4Resource allocation is needed when multiple users or multiple jobs run concurrently. (True / False)
الإجابة
True: يجب توزيع الموارد عليهم.
5Protection and security precautions are needed only in some parts of the system. (True / False)
الإجابة
False: يجب أن تكون في كل النظام.
نظرة على خدمات نظام التشغيل
A View of Operating System Services
الرسم يوضح الطبقات: في الأعلى برامج المستخدم، ثم واجهات المستخدم (GUI و batch و command line)، ثم System calls، ثم الخدمات داخل نظام التشغيل، وفي الأسفل العتاد.
أي أن البرامج تطلب الخدمات من نظام التشغيل عن طريق System calls.
نظرة على خدمات نظام التشغيل · A View of Operating System Services
اختبر نفسك
1In the figure, which layer is directly below user interfaces?
a) Hardware · b) System calls · c) Services · d) User programs
الإجابة
b) System calls: System calls.
2Which of the following is shown as a type of user interface in the figure?
a) Accounting · b) Batch · c) Error detection · d) File systems
الإجابة
b) Batch: Batch من أنواع الواجهات.
3In the figure, the services are part of the operating system. (True / False)
الإجابة
True: داخل طبقة نظام التشغيل.
4In the figure, the hardware is at the top. (True / False)
الإجابة
False: العتاد في الأسفل.
واجهة المستخدم النصية
الواجهة النصية (CLI) أو مفسّر الأوامر تسمح بإدخال الأوامر مباشرة.
User Operating System Interface - CLI
Command Line Interface (CLI) or command interpreter allows direct command entry.
الواجهة النصية يكتب فيها المستخدم أوامر نصية مباشرة، والـ Command interpreter يقرأ الأمر وينفّذه.
قد تكون الأوامر مدمجة فيه، أو تكون أسماء برامج يشغّلها. وفي الحالة الثانية يمكن إضافة أوامر جديدة دون تعديل الـ Shell.
تُنفَّذ أحياناً داخل النواة، وأحياناً كبرنامج نظام.
Sometimes implemented in kernel, sometimes by systems program.
مفسّر الأوامر قد يكون جزءاً من النواة نفسها، أو برنامجاً منفصلاً يأتي مع النظام.
أحياناً توجد منه أنواع متعددة تُسمّى .
Sometimes multiple flavors implemented – .
مفسّر الأوامر قد يكون له أكثر من نوع، وكل نوع منها يُسمّى Shell.
وضّح لي أكثر
مثال: في Linux توجد أنواع مثل Bash و Bourne shell.
وظيفته الأساسية: يجلب الأمر من المستخدم وينفّذه.
Primarily fetches a command from user and executes it.
مهمة مفسّر الأوامر الأساسية: استقبال الأمر الذي يكتبه المستخدم، ثم تنفيذه.
وضّح لي أكثر
مثال: تكتب أمراً لعرض الملفات، فيعرضها لك.
الأوامر أحياناً مدمجة فيه، وأحياناً تكون أسماء برامج. وفي الحالة الثانية، إضافة ميزات جديدة لا تتطلب تعديل الـ Shell.
Sometimes commands built-in, sometimes just names of programs. If the latter, adding new features doesn't require shell modification.
إذا كان الأمر اسم برنامج، يكفي إضافة برنامج جديد ليصبح لديك أمر جديد، دون تغيير الـ Shell نفسه.
اختبر نفسك
1The CLI is also called:
a) Command interpreter · b) Device driver · c) Kernel · d) Desktop
الإجابة
a) Command interpreter: مفسّر الأوامر.
2Multiple flavors of command interpreters are called:
a) Icons · b) Shells · c) Folders · d) Drivers
الإجابة
b) Shells: Shells.
3The CLI is sometimes implemented in the kernel and sometimes by a systems program. (True / False)
الإجابة
True: الحالتان ممكنتان.
4If commands are just names of programs, adding new features requires shell modification. (True / False)
الإجابة
False: لا يتطلب تعديل الـ Shell.
واجهة المستخدم الرسومية
واجهة سهلة الاستخدام تحاكي سطح المكتب.
User Operating System Interface - GUI
User-friendly desktop metaphor interface.
الواجهة الرسومية تعتمد على سطح المكتب، والتعامل فيها بالفأرة ولوحة المفاتيح والشاشة: أيقونات تمثل الملفات والبرامج، والضغط عليها ينفّذ أفعالاً مختلفة.
وأغلب الأنظمة اليوم تجمع بين الواجهتين: الرسومية والنصية.
تستخدم عادةً الفأرة ولوحة المفاتيح والشاشة.
1
Usually mouse, keyboard, and monitor.
الأيقونات تمثّل الملفات والبرامج والأفعال وغيرها.
Icons represent files, programs, actions, etc.
في الواجهة الرسومية، الأيقونات صور صغيرة تمثّل الملفات والبرامج والأفعال.
وضّح لي أكثر
مثال: أيقونة سلة المحذوفات، وأيقونة المتصفح.
أزرار الفأرة على العناصر تنفّذ أفعالاً مختلفة: عرض معلومات، خيارات، تنفيذ وظيفة، فتح مجلد (يُسمّى Folder).
Various mouse buttons over objects in the interface cause various actions (provide information, options, execute function, open directory (known as a folder)).
الضغط بأزرار الفأرة على عناصر الواجهة يؤدي أفعالاً مختلفة: عرض معلومات، أو خيارات، أو تنفيذ وظيفة، أو فتح مجلد (Folder).
وضّح لي أكثر
مثال: الضغط الأيمن يعرض الخيارات، والضغط المزدوج يفتح المجلد.
اختُرعت في .
4
Invented at .
أنظمة تجمع الواجهتين
Many systems now include both CLI and GUI interfaces
Microsoft Windows: واجهة رسومية مع Shell نصي (command).
1
Microsoft Windows is GUI with CLI "command" shell.
Apple Mac OS X: واجهة Aqua الرسومية، وتحتها نواة UNIX، مع Shells متاحة.
2
Apple Mac OS X as "Aqua" GUI interface with UNIX kernel underneath and shells available.
Solaris: واجهة نصية، مع واجهات رسومية اختيارية (Java Desktop و KDE).
3
Solaris is CLI with optional GUI interfaces (Java Desktop, KDE).
اختبر نفسك
1Where was the GUI invented?
a) Microsoft · b) Apple · c) Xerox PARC · d) IBM
الإجابة
c) Xerox PARC: في Xerox PARC.
2Mac OS X has the ______ GUI interface with a UNIX kernel underneath.
a) Aqua · b) KDE · c) Java Desktop · d) Bourne
الإجابة
a) Aqua: Aqua.
3Solaris is:
a) GUI only · b) CLI with optional GUI interfaces · c) Batch only · d) Without any interface
الإجابة
b) CLI with optional GUI interfaces: CLI مع واجهات رسومية اختيارية.
4Many systems now include both CLI and GUI interfaces. (True / False)
الإجابة
True: مثل Windows و Mac OS X و Solaris.
5In a GUI, a directory is known as an icon. (True / False)
الإجابة
False: المجلد اسمه Folder.
استدعاءات النظام
واجهة برمجية للوصول إلى الخدمات التي يقدّمها نظام التشغيل.
System Calls
Programming interface to the services provided by the OS.
System calls هي الطريقة التي تطلب بها البرامج خدمات نظام التشغيل، وتُكتب عادة بلغة C أو C++.
لكن المبرمج غالباً لا يستدعيها مباشرة، بل يستخدم API جاهزة، وهي التي تستدعي System calls بدلاً منه.
تُكتب عادةً بلغة عالية المستوى (C أو C++).
1
Typically written in a high-level language (C or C++).
البرامج تصل إليها غالباً عبر عالية المستوى، بدلاً من استدعائها مباشرة.
Mostly accessed by programs via a high-level rather than direct system call use.
المبرمج يستدعي دالة من الـ API، والدالة هي التي تستدعي System call المناسب.
وضّح لي أكثر
مثال: في Java تكتب أمراً لفتح ملف، والـ Java API تتولى استدعاء نظام التشغيل.
أشهر ثلاث واجهات API
Three most common APIs
Win32 API لنظام Windows.
1
Win32 API for Windows.
للأنظمة المبنية على POSIX (تقريباً كل إصدارات UNIX و Linux و Mac OS X).
2
for POSIX-based systems (including virtually all versions of UNIX, Linux, and Mac OS X).
Java API لـ .
3
Java API for the .
لماذا نستخدم API بدلاً من System calls مباشرة؟ (أسماء System calls في المقرر أسماء عامة).
Why use APIs rather than system calls? (Note that the system-call names used throughout this text are generic)
اختبر نفسك
1System calls are:
a) A programming interface to the services provided by the OS · b) A type of hardware · c) A user interface · d) A storage device
الإجابة
a) A programming interface to the services provided by the OS: واجهة برمجية لخدمات نظام التشغيل.
2Which API is used for POSIX-based systems (UNIX, Linux, Mac OS X)?
a) Win32 API · b) POSIX API · c) Java API · d) Aqua API
الإجابة
b) POSIX API: POSIX API.
3Programs mostly access system calls via:
a) DMA · b) A high-level API · c) The bootstrap · d) The cache
الإجابة
b) A high-level API: عبر API عالية المستوى.
4System calls are typically written in a high-level language (C or C++). (True / False)
الإجابة
True: بلغة C أو C++.
5The Java API is used for Windows only. (True / False)
الإجابة
False: Java API لـ JVM، و Win32 لـ Windows.
مثال على استدعاءات النظام
تسلسل استدعاءات النظام لنسخ محتوى ملف إلى ملف آخر.
Example of System Calls
System call sequence to copy the contents of one file to another file.
حتى عملية بسيطة مثل نسخ ملف تحتاج سلسلة طويلة من System calls: الحصول على اسمَي الملفين، فتح ملف الإدخال، إنشاء ملف الإخراج، ثم تكرار القراءة والكتابة حتى تنتهي القراءة، ثم الإغلاق والإنهاء.
الحصول على اسم ملف الإدخال: عرض رسالة على الشاشة، ثم استقبال الإدخال.
1
Acquire input file name: write prompt to screen, accept input.
الحصول على اسم ملف الإخراج: عرض رسالة، ثم استقبال الإدخال.
2
Acquire output file name: write prompt to screen, accept input.
فتح ملف الإدخال: إذا لم يكن موجوداً، يتوقف.
3
Open the input file – if file doesn't exist, abort.
إنشاء ملف الإخراج: إذا كان موجوداً، يتوقف.
4
Create output file – if file exists, abort.
تكرار: القراءة من ملف الإدخال ثم الكتابة في ملف الإخراج، حتى تفشل القراءة.
Loop: read from input file, write to output file, until read fails.
«تفشل القراءة» تعني أن الملف انتهى ولم يبقَ شيء لقراءته.
إغلاق ملف الإخراج، عرض رسالة الانتهاء، ثم الإنهاء بشكل طبيعي.
6
Close output file, write completion message to screen, terminate normally.
تسلسل استدعاءات النظام لنسخ ملف · Example System Call Sequence
اختبر نفسك
1In the copy example, what happens if the input file doesn't exist?
a) Create it · b) Abort · c) Write to screen and continue · d) Close output file
الإجابة
b) Abort: يتوقف (abort).
2The read/write loop in the copy example continues until:
a) The output file is closed · b) Read fails · c) The user presses a key · d) The kernel stops
الإجابة
b) Read fails: حتى تفشل القراءة.
3If the output file already exists, the copy sequence aborts. (True / False)
الإجابة
True: if file exists, abort.
4Copying a file requires only one system call. (True / False)