جابه‌جایی (رایانه)

از ویکی‌پدیا، دانشنامهٔ آزاد

جابجایی فرایند اختصاص آدرس بارگذاری برای کدهای وابسته به موقعیت و داده‌های یک برنامه و تنظیم کد و داده برای بازگرداندن آدرس‌های اختصاص داده شده‌است.[۱][۲] قبل از ظهور سیستم‌های چند پردازشی، و همچنین در بسیاری از سیستم‌های نهفته، آدرس‌های عناصر مطلق بودند و از یک مکان مشخص و اغلب صفر شروع می‌شدند. از آنجا که سیستم‌های چند پردازشی به صورت پویا بین برنامه‌ها جابه‌جا می‌شوند، جابه‌جایی اشیا با استفاده از کد مستقل از موقعیت، لازم بود. پیوند دهنده معمولاً قبل از اجرای برنامه، جابجایی را همراه با تفکیک نماد، فرایند جستجو در فایل‌ها و کتابخانه‌ها برای جایگزین کردن نمادها یا نام کتابخانه‌ها با آدرس‌های قابل استفاده واقعی در حافظه، انجام می‌دهد.

جابجایی معمولاً توسط پیوند دهنده در زمان پیوند انجام می‌شود، اما همچنین می‌تواند در زمان بارگذاری توسط یک لودر جابجایی یا در زمان اجرا توسط خود برنامه در حال اجرا انجام شود. برخی از طراحی‌ها با تغییر دادن اختصاص آدرس برای زمان اجرا، از جابجایی کامل جلوگیری می‌کنند. این به عنوان صفر حسابی آدرس شناخته شده است.

[ کدام؟

منابع[ویرایش]

  1. "Types of Object Code". iRMX 86 Application Loader Reference Manual (PDF). Intel. pp.  1–2, 1–3. Retrieved 2017-08-21. […] Absolute code, and an absolute object module, is code that has been processed by LOC86 to run only at a specific location in memory. The Loader loads an absolute object module only into the specific location the module must occupy. Position-independent code (commonly referred to as PIC) differs from absolute code in that PIC can be loaded into any memory location. The advantage of PIC over absolute code is that PIC does not require you to reserve a specific block of memory. When the Loader loads PIC, it obtains iRMX 86 memory segments from the pool of the calling task's job and loads the PIC into the segments. A restriction concerning PIC is that, as in the PL/M-86 COMPACT model of segmentation […], it can have only one code segment and one data segment, rather than letting the base addresses of these segments, and therefore the segments themselves, vary dynamically. This means that PIC programs are necessarily less than 64K bytes in length. PIC code can be produced by means of the BIND control of LINK86. Load-time locatable code (commonly referred to as LTL code) is the third form of object code. LTL code is similar to PIC in that LTL code can be loaded anywhere in memory. However, when loading LTL code, the Loader changes the base portion of pointers so that the pointers are independent of the initial contents of the registers in the microprocessor. Because of this fixup (adjustment of base addresses), LTL code can be used by tasks having more than one code segment or more than one data segment. This means that LTL programs may be more than 64K bytes in length. FORTRAN 86 and Pascal 86 automatically produce LTL code, even for short programs. LTL code can be produced by means of the BIND control of LINK86. […]
  2. Levine, John R. (October 1999). "Chapter 1: Linking and Loading". Linkers and Loaders. Morgan Kaufmann. p.  5. ISBN 1-55860-496-0.