Background process

A background process is a computer process that runs behind the scenes (i.e., in the background) and without user intervention.[1] Typical tasks for these processes include logging, system monitoring, scheduling,[2] and user notification.[3]

On a Windows system, a background process is either a computer program that does not create a user interface, or a Windows service. The former are started just as any other program is started, e.g., via Start menu. Windows services, on the other hand, are started by Service Control Manager. In Windows Vista and later, they are run in a separate session.

On a Unix-like system, a daemon would be a background process. However, in a shell that supports job control, a process that is in a process group whose process group ID differs from its terminal group ID (TGID) would be a background process. (The TGID of a process is the process ID of the process group leader that opened the terminal, which is typically the login shell. The TGID identifies the control terminal of the process group.) This type of process is unable to receive keyboard signals from its parent terminal, and typically will not send output to that terminal.[4] This more technical definition does not distinguish between whether or not the process can receive user intervention. Although background processes are typically used for purposes needing few resources, any process can be run in the background, and such a process will behave like any other process, with the exceptions given above.[1]

Windows services

In Windows NT family of operating systems, a Windows service is a dedicated background process.[5] A Windows service must conform to the interface rules and protocols of the Service Control Manager, the component responsible for managing Windows services.[6]

Windows services can be configured to start when the operating system starts, and to run in the background as long as Windows runs. Alternatively, they can be started manually or by an event. Windows NT operating systems include numerous services which run in context of three user accounts: System, Network Service and Local Service. These Windows components are often associated with Host Process for Windows Services: svchost.exe. Since Windows services operate in the context of their own dedicated user accounts, they can operate when a user is not logged on.

Before Windows Vista, services installed as "interactive services" could interact with Windows desktop and show a graphical user interface. With Windows Vista, however, interactive services became deprecated and ceased operating properly, as a result of Windows Service Hardening.[7][8]

The three principal means of managing Windows services are:

  1. Services snap-in for Microsoft Management Console
  2. sc.exe
  3. Windows PowerShell

Daemon

A daemon is a type of background process designed to run continually in the background, waiting for event(s) to occur or condition(s) to be met.[9] When launched with the daemon function, daemons are disassociated from their parent terminal.[10]

Background jobs in Unix

From a Unix command line, a background process can be launched using the "&" operator. The bg command can resume a suspended job (sending SIGCONT), running it in the background. Using the fg command will also set the foreground process group of the controlling terminal of the session to the process group of the job, bringing the job into the foreground. The jobs command will list all processes associated with the current terminal and can be used to bring background processes into the foreground.[4][11]

عند انتهاء جلسة تسجيل الدخول ، سواءً بتسجيل الخروج الصريح أو بفصل الشبكة، تُنهى جميع العمليات، بما فيها عمليات الخلفية، تلقائيًا لمنعها من أن تصبح عمليات يتيمة . تحديدًا، عند خروج المستخدم من عملية بدء تشغيل الصدفة، تُرسل العملية، كجزء من عملية الإغلاق، إشارة إنهاء ( SIGHUP ) إلى جميع مهامها لإنهاء جميع العمليات في مجموعة العمليات المعنية . لاستمرار تشغيل العمليات، يمكن إما عدم إنهاء الجلسة، أو إنهاء الجلسة دون إنهاء العمليات. يمكن استخدام مُضاعِف طرفية لإبقاء الجلسة قيد التشغيل مع فصل طرفية افتراضية عنها، مما يُبقي العمليات قيد التشغيل كعمليات فرعية للجلسة؛ ويمكن للمستخدم إعادة ربط الجلسة لاحقًا. أو يمكن منع الإنهاء إما ببدء العملية عبر الأمر nohup (لإخبار العملية بتجاهل SIGHUP)، أو بتشغيلها لاحقًا disownباستخدام مُعرّف المهمة، مما يؤدي إما إلى إزالة المهمة من قائمة المهام تمامًا، أو ببساطة منع إرسال SIGHUP. في الحالة الأخيرة، عندما تنتهي الجلسة، لا يتم إنهاء العمليات الفرعية، إما لأنها لم يتم إرسال إشارة SIGHUP إليها أو لأنها تتجاهلها، وبالتالي تصبح عمليات يتيمة، والتي يتم تبنيها بعد ذلك بواسطة عملية التهيئة (تقوم النواة بتعيين عملية التهيئة كعملية أصلية لها)، وتستمر في العمل بدون جلسة، وتسمى الآن بالبرامج الخفية .

مثال

في هذا المثال الذي يعمل على نظام يونكس ، تم تشغيل أداة sleep في الخلفية. بعد ذلك، تم تشغيل أداة ps في المقدمة، حيث أخرجت النص الموضح أدناه. تم تشغيل كلتا الأداتين من سطر الأوامر. [ 12 ]

PID TT STAT TIME COMMAND 54659 10 S 0 :00.06 su ( zsh ) 54703 10 IN 0 :00.00 - sleep 1000 54852 10 R+ 0 :00.00 - ps -U botty -axd 

الهواتف الذكية

تتضمن العديد من الإصدارات الحديثة لأنظمة تشغيل الهواتف الذكية وأجهزة المساعد الرقمي الشخصي (PDA) إمكانية تشغيل العمليات في الخلفية. ونظرًا لمحدودية إمكانيات الأجهزة، غالبًا ما تقتصر العمليات في الخلفية على أنظمة تشغيل الأجهزة المحمولة على مهام أو مستويات استهلاك محددة. ففي نظام أندرويد ، قد يكون استخدام وحدة المعالجة المركزية للعمليات في الخلفية محدودًا بنسبة 5-10%. [ 13 ] أما في نظام iOS من آبل، فتقتصر التطبيقات على مجموعة فرعية من الوظائف أثناء تشغيلها في الخلفية. [ 3 ] وفي كل من نظامي iOS وأندرويد، يمكن للنظام إيقاف العمليات في الخلفية، وكذلك التطبيقات غير المستخدمة، إذا كانت تستهلك قدرًا كبيرًا من الذاكرة أو طاقة البطارية. [ 3 ] [ 13 ]

انظر أيضاً

مراجع

  1. 1 2 "ما هو نظام التشغيل؟، العمليات" . دليل لينكس التعليمي. مؤرشف من الأصل في 15 أغسطس 2020. تم الاطلاع عليه في 14 نوفمبر 2010 .
  2. ميشيل سيران (ديسمبر 1993). مفاهيم قاعدة بيانات أوراكل، الإصدار 10g، الإصدار 1. شركة أوراكل. B10743-01. مؤرشف من الأصل في 2 مارس 2013. تم الاطلاع عليه في 12 نوفمبر 2010 .
  3. 1 2 3 خيسوس دياز (8 أبريل 2010). "كيف تعمل خاصية تعدد المهام في نظام تشغيل آيفون 4.0 الجديد" . جيزمودو. مؤرشف من الأصل في 2 نوفمبر 2010. تم الاطلاع عليه في 14 نوفمبر 2010 .
  4. 1 2 دليل مرجعي لبرنامج GNU Bash، الإصدار 4.1، أساسيات التحكم في العمليات . مؤسسة البرمجيات الحرة، 23 ديسمبر 2009. مؤرشف من الأصل في 3 ديسمبر 2010. تم الاطلاع عليه في 10 نوفمبر 2010 .
  5. "نظرة عامة على الخدمات" . مايكروسوفت تك نت . مايكروسوفت . تم الاطلاع عليه بتاريخ 29 مارس 2013 .
  6. "الخدمات" . شبكة مطوري مايكروسوفت . مايكروسوفت . تم الاطلاع عليه بتاريخ 29 مارس 2013 .
  7. "New Elevation PowerToys for Windows Vista". TechNet Magazine. Microsoft. June 2008. Retrieved 21 June 2013. The service CmdAsSystem is configured as interactive whose support is being deprecated. The service may not function properly. The problem is that this script tries to create and start an interactive service. Interactive services will not function correctly due to Session 0 Isolation in Windows Vista.
  8. "Services in Windows". MSDN. Microsoft. 18 October 2010. Retrieved 21 June 2013.
  9. Eric S. Raymond (1 October 2004). The Jargon File, version 4.4.8, "daemon". Archived from the original on 3 November 2010. Retrieved 10 November 2010.
  10. raf (12 June 2010). Linux User's Manual, "daemon". Archived from the original on 21 October 2010. Retrieved 10 November 2010.
  11. Åke Nordlund (7 February 2007). "Background Processes in Unix/Linux". Archived from the original on 13 February 2012. Retrieved 10 November 2010.
  12. "POSIX "ps"". IEEE Std 1003.1, 2004 Edition.
  13. 12Matt Buchanan (2010-04-29). "Giz Explains: How Multitasking Works on a Phone". Gizmodo. Archived from the original on 17 October 2010. Retrieved 14 November 2010.