Loader (computing)

In computer systems a loader is the part of an operating system that is responsible for loading programs and libraries. It is one of the essential stages in the process of starting a program, as it places programs into memory and prepares them for execution. Loading a program involves either memory-mapping or copying the contents of the executable file containing the program instructions into memory, and then carrying out other required preparatory tasks to prepare the executable for running. Once loading is complete, the operating system starts the program by passing control to the loaded program code.

All operating systems that support program loading have loaders, apart from highly specialized computer systems that only have a fixed set of specialized programs. Embedded systems typically do not have loaders, and instead, the code executes directly from ROM or similar. In order to load the operating system itself, as part of booting, a specialized boot loader is used. In many operating systems, the loader resides permanently in memory, though some operating systems that support virtual memory may allow the loader to be located in a region of memory that is pageable.

In the case of operating systems that support virtual memory, the loader may not actually copy the contents of executable files into memory, but rather may simply declare to the virtual memory subsystem that there is a mapping between a region of memory allocated to contain the running program's code and the contents of the associated executable file. (See memory-mapped file.) The virtual memory subsystem is then made aware that pages with that region of memory need to be filled on demand if and when program execution actually hits those areas of unfilled memory. This may mean parts of a program's code are not actually copied into memory until they are actually used, and unused code may never be loaded into memory at all.

Responsibilities

In Unix, the loader is the handler for the system call execve().[1] The Unix loader's tasks include:

  1. validation (permissions, memory requirements etc.);
  2. memory-mapping the executable object from the disk into main memory;
  3. copying the command-line arguments into virtual memory;
  4. initializing registers (e.g., the stack pointer);
  5. jumping to the program entry point (_start).

In Microsoft Windows 7 and above, the loader is the LdrInitializeThunk function contained in ntdll.dll, which does the following:

  1. initialisation of structures in the DLL itself (i.e. critical sections, module lists);
  2. validation of executable to load;
  3. creation of a heap (via the function RtlCreateHeap);
  4. allocation of environment variable block and PATH block;
  5. addition of executable and NTDLL to the module list (a doubly-linked list);
  6. loading of KERNEL32.DLL to obtain several important functions, for instance BaseThreadInitThunk;
  7. loading of executable's imports (i.e. dynamic-link libraries) recursively (check the imports' imports, their imports and so on);
  8. in debug mode, raising of system breakpoint;
  9. initialisation of DLLs;
  10. garbage collection;
  11. calling NtContinue on the context parameter given to the loader function (i.e. jumping to RtlUserThreadStart, that will start the executable)

Relocating loaders

Some operating systems need relocating loaders, which adjust addresses (pointers) in the executable to compensate for variations in the address at which loading starts. The operating systems that need relocating loaders are those in which a program is not always loaded into the same location in the (virtual) address space and in which pointers are absolute addresses rather than offsets from the program's base address. Some well-known examples are IBM's OS/360 for their System/360 mainframes, and its descendants, including z/OS for the z/Architecture mainframes.

OS/360 & Derivatives

In OS/360 and descendant systems, the (privileged) operating system facility is called IEWFETCH,[2] and is an internal component of the OS Supervisor, whereas the (non-privileged) LOADER application can perform many of the same functions, plus those of the Linkage Editor, and is entirely external to the OS Supervisor (although it certainly uses many Supervisor services).

IEWFETCH utilizes highly specialized channel programs, and it is theoretically possible to load and to relocate an entire executable within one revolution of the DASD media (about 16.6 ms maximum, 8.3 ms average, on "legacy" 3,600 rpm drives). For load modules which exceed a track in size, it is also possible to load and to relocate the entire module without losing a revolution of the media.

IEWFETCH also incorporates facilities for so-called overlay structures, and which facilitates running potentially very large executables in a minimum memory model (as small as 44 KB on some versions of the OS, but 88 KB and 128 KB are more common).

The OS's nucleus (the always resident portion of the Supervisor) itself is formatted in a way that is compatible with a stripped-down version of IEWFETCH. Unlike normal executables, the OS's nucleus is "scatter loaded": parts of the nucleus are loaded into different portions of memory; in particular, certain system tables are required to reside below the initial 64 KB, while other tables and code may reside elsewhere.

The system's Linkage Editor application is named IEWL.[3] IEWL's main function is to associate load modules (executable programs) and object modules (the output from, say, assemblers and compilers), including "automatic calls" to libraries (high-level language "built-in functions"), into a format which may be most efficiently loaded by IEWFETCH. There are a large number of editing options, but for a conventional application only a few of these are commonly employed.

The load module format includes an initial "text record", followed immediately by the "relocation and/or control record" for that text record, followed by more instances of text record and relocation and/or control record pairs, until the end of the module.

The text records are usually very large; the relocation and/or control records are small as IEWFETCH's three relocation and/or control record buffers are fixed at 260 bytes (smaller relocation and/or control records are certainly possible, but 260 bytes is the maximum possible, and IEWL ensures that this limitation is complied with, by inserting additional relocation records, as required, before the next text record, if necessary; in this special case, the sequence of records may be: ..., text record, relocation record, ..., control record, text record, ...).

A special byte within the relocation and/or control record buffer is used as a "disabled bit spin" communication area, and is initialized to a unique value. The Read CCW for that relocation and/or control record has the Program Controlled Interrupt bit set. The processor is thereby notified when that CCW has been accessed by the channel via a special IOS exit. At this point the processor enters the "disabled bit spin" loop (sometimes called "the shortest loop in the world"). Once that byte changes from its initialized value, the CPU exits the bit spin, and relocation occurs, during the "gap" within the media between the relocation and/or control record and the next text record. If relocation is finished before the next record, the NOP CCW following the Read will be changed to a TIC, and loading and relocating will proceed using the next buffer; if not, then the channel will stop at the NOP CCW, until it is restarted by IEWFETCH via another special IOS exit. The three buffers are in a continuous circular queue, each pointing to its next, and the last pointing to the first, and three buffers are constantly reused as loading and relocating proceeds.

IEWFETCH can, thereby, load and relocate a load module of any practical size, and in the minimum possible time.

Dynamic linkers

Dynamic linking loaders are another type of loader that load and link shared libraries (like .so files, .dll files or .dylib files) to already loaded running programs.

Where such shared libraries can be shared by multiple processes, with only one single copy of the shared code possibly appearing at a different (virtual) address in each process's address space, the code in the shared library is required to be relocatable, ie the library must only use self-relative or code segment base-relative internal addresses throughout. Some processor have instructions that can use self-relative code-references in order to facilitate this.

See also

References

  1. ^ "exec". The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition. The Open Group. Retrieved 2008-06-23.
  2. ^ IBM Corporation (1972). IBM OS MVT Supervisor (PDF).
  3. ^ IBM Corporation (1972). IBM OS Linkage Editor and Loader (PDF).

Read other articles:

شيرين الرفاعي شيرين الرفاعي الجهني معلومات شخصية الميلاد 24 أكتوبر 1989 (العمر 34 سنة)المدينة المنورة، السعودية الجنسية  السعودية الحياة العملية التعلّم ماجستير – الإقتصاد المهنة إعلامية تعديل مصدري - تعديل   شيرين الرفاعي الجهني (24 أكتوبر 1989 -)، إعلامية وممثلة وأديبة سع...

 

 

Not to be confused with FIFA World Cup. Football tournamentVIVA World CupFounded2006RegionInternational (N.F.-Board)Current champions Kurdistan Region (2012)Most successful club(s) Padania(3 titles)Websitewww.nfboard.org#!viva/cz1i The VIVA World Cup was an international association football tournament organized by the N.F.-Board, an umbrella association for teams unaffiliated with FIFA, held five times between 2006 and 2012.[1] History Occitania 2006Sapmi 2008Padania 2...

 

 

  لمعانٍ أخرى، طالع جون ماكنزي (توضيح). جون ماكنزي   معلومات شخصية الميلاد 6 أكتوبر 1839  الوفاة 6 أغسطس 1901 (61 سنة)   سبب الوفاة سرطان المثانة  مواطنة نيوزيلندا  مناصب وزير الزراعة (2 )   في المنصب24 يناير 1891  – 27 يونيو 1900  جورج ريتشاردسون  توماس يونغ دو...

4815.416666666667Koordinaten: 48° 0′ N, 15° 25′ O Viertel und Bezirke Niederösterreichs Das Mostviertel, altertümlich Viertel ober dem Wienerwald, ist der südwestliche Teil Niederösterreichs. Seit der Bildung der Politischen Bezirke 1868 haben die Viertel in Niederösterreich keine rechtliche Grundlage mehr und sind reine Landschaftsbezeichnungen. Dabei wurde die ältere Kreiseinteilung ersetzt, die sich noch an den alten Vierteln orientierte. Im Norden wird es v...

 

 

2002 studio album by Aventura We Broke the RulesStudio album by AventuraReleasedJuly 2, 2002 (2002-07-02)Recorded2001–2002Genre Bachata pop R&B hip-hop rock merengue salsa Length45:42[1]LabelPremium Latin MusicAventura chronology Generation Next(2000) We Broke the Rules(2002) Love & Hate(2003) Singles from We Broke the Rules ObsesiónReleased: 2002 Todavía Me AmasReleased: 2002 Amor De MadreReleased: 2002 Enséñame A OlvidarReleased: 2002 Alternate Cover...

 

 

2022 studio album by JID The Forever StoryStudio album by JIDReleasedAugust 26, 2022Recorded2020–2022GenreHip hopalternative hip hop[1]Length66:32Label Dreamville Interscope Producer2One2AviadBadBadNotGoodBenjiCardiakChildish MajorChristoDJ KhalilDJ SchemeE. JonesEliteGrooveHero the BandHollywood ColeJames BlakeJD BeckKaytranadaKhrysisMonte BookerNamiNonstop da HitmanNurіPlussQRileyTane RunoTommy BrownTu!YuliJID chronology Spilligion(2020) The Forever Story(2022) Singles from T...

Cổng Ấn ĐộGATEWAY OF INDIA MUMBAI Cảnh buổi tốiVị trí tại MumbaiXem bản đồ MumbaiCổng Ấn Độ (Maharashtra)Xem bản đồ MaharashtraCổng Ấn Độ (Ấn Độ)Xem bản đồ Ấn ĐộThông tin chungDạngKhải hoàn mônPhong cáchẤn Độ-SaracenicĐịa điểmMumbai, MaharashtraTọa độ18°55′19″B 72°50′05″Đ / 18,9219°B 72,8346°Đ / 18.9219; 72.8346Độ cao nền10 m (33 ft)Chủ sở hữuArchaeologic...

 

 

Este artigo foi avaliado automaticamente com qualidade 2 e faz parte do âmbito de um WikiProjeto: Aves.Para o Projeto Ornitológico este artigo possui importância ainda não avaliada. Se você se interessa pelo assunto, visite o projeto para conhecer as tarefas e discussões em curso.Se não tiver suas questões respondidas nesta página de discussão procure o(s) wikiprojeto(s) acima. A única coisa que ainda faltava acontecer (pois já aconteceu de tudo o que se possa imaginar na Wikipéd...

 

 

Datenbanklinks zu NGC 5005 GalaxieNGC 5005 {{{Kartentext}}} Aufnahme des Hubble-Weltraumteleskops AladinLite Sternbild Jagdhunde PositionÄquinoktium: J2000.0, Epoche: J2000.0 Rektaszension 13h 10m 56,2s[1] Deklination +37° 03′ 33″[1] Erscheinungsbild Morphologischer Typ SAB(rs)bc / Sy2 / LINER[1] Helligkeit (visuell) 9,8 mag[2] Helligkeit (B-Band) 10,6 mag[2] Winkel­ausdehnung 5,8′ × 2,9′[...

This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: History of multitrack recording – news · newspapers · books · scholar · JSTOR (May 2013) (Learn how and when to remove this template message) AMPEX 440 (two-track, four-track) and 16-track MM1000 Scully 280 eight-track recorder using 1 tape at the Stax Museum o...

 

 

دوري كرة القدم النرويجي الدرجة الأولى 1968 تفاصيل الموسم الدوري النرويجي الدرجة الأولى  البلد النرويج  البطل نادي ستارت  دوري كرة القدم النرويجي الدرجة الأولى 1967  دوري كرة القدم النرويجي الدرجة الأولى 1969  تعديل مصدري - تعديل   دوري كرة القدم النرويجي الدرجة الأ

 

 

Public high school in Beverly Hills, California Beverly Hills High SchoolBeverly Hills High School in Beverly Hills, CaliforniaAddress241 Moreno DriveBeverly Hills, California 90212United StatesCoordinates34°03′46″N 118°24′45″W / 34.062851°N 118.412464°W / 34.062851; -118.412464InformationTypePublic high schoolMottoToday well livedEstablished1927; 96 years ago (1927)School districtBeverly Hills Unified School DistrictNCES School ID06048300...

State park in Oregon, United States This article may require cleanup to meet Wikipedia's quality standards. No cleanup reason has been specified. Please help improve this article if you can. (July 2011) (Learn how and when to remove this template message) Guy W. Talbot State ParkGuy W. Talbot State Park entrance sign, May 2016Show map of OregonShow map of the United StatesTypePublic, stateLocationMultnomah County, OregonNearest cityTroutdaleCoordinates45°32′07″N 122°13′31″W...

 

 

يفتقر محتوى هذه المقالة إلى الاستشهاد بمصادر. فضلاً، ساهم في تطوير هذه المقالة من خلال إضافة مصادر موثوق بها. أي معلومات غير موثقة يمكن التشكيك بها وإزالتها. (2020) هذه المقالة يتيمة إذ تصل إليها مقالات أخرى قليلة جدًا. فضلًا، ساعد بإضافة وصلة إليها في مقالات متعلقة بها. (يونيو...

 

 

Infectious disease, often just the flu For other uses, see Influenza (disambiguation), Flu (disambiguation), and Grippe (disambiguation). Flus redirects here. For the diagnostic class of thyroid nodules, see FLUS. Not to be confused with Flue. Medical conditionInfluenzaOther namesflu, the flu, grippe (French for flu)Influenza virus, magnified approximately 100,000 timesSpecialtyInfectious diseaseSymptomsFever, runny nose, sore throat, muscle pain, headache, coughing, fatigueUsual onset1–4 d...

بنية تحتية عامة موجودات ثابتة ومرافق مطار جسر موجة عريضة قنال البنية التحتية الحرجة سد توليد الكهرباء طاقة (مجتمع) نفايات خطرة مستشفى سد مائي منارة متنزه ميناء مواصلات عامة سكن اجتماعي مدرسة حكومية أشغال عامة سكة حديد طريق صرف صحي نفايات صلبة اتصالات مرفق عمومي شبكة توزيع ا

 

 

Postwar administration of Malaya before its independence British Military Administration of Malaya1945–1946 Flag Royal coat of arms The Empire of Japan surrendered to the British Empire in Kuala Lumpur in 1945.StatusInterim military governanceCapitalKuala Lumpur (de facto)GovernmentMilitary administrationHistorical eraPost-war• Surrender of Japan 2 September 1945• British Military Administration established 12 September 1945• Formation of Malayan Union 1 April 1946 Curr...

 

 

American football player (1925–1980) Robert HoernschemeyerNo. 64, 90, 14Hoernschemeyer on a 1952 Bowman football cardBorn:(1925-09-25)September 25, 1925Cincinnati, Ohio, U.S.Died:June 18, 1980(1980-06-18) (aged 54)Detroit, Michigan, U.S.Career informationPosition(s)Running backHeight5 ft 11 in (180 cm)Weight194 lb (88 kg)CollegeUnited States Naval AcademyIndiana UniversityHigh schoolElder (Cincinnati, Ohio)NFL draft1947 / Round: 11 / Pick: 94Draf...

American neuropsychologist, neurobiologist and Nobel laureate Roger SperryBornRoger Wolcott SperryAugust 20, 1913 (2018-08-21)Hartford, Connecticut, U.S.DiedApril 17, 1994 (1994-04-18) (aged 80)Pasadena, California, U.S.Alma mater Oberlin College University of Chicago (PhD) Known for Split-brain research Chemoaffinity hypothesis AwardsNobel Prize in Physiology or Medicine (1981)Scientific careerFieldsNeuropsychologyThesisFunctional results of crossing nerves and transposin...

 

 

Gambian poet and economist (born 1958) Tijan SallahPersonal detailsBornTijan M. Sallah (1958-03-06) 6 March 1958 (age 65)Serekunda, Kombo Division, The Gambia, West AfricaNationalityGambian/AmericanEducationVirginia Polytechnic Institute and State UniversityBerea CollegeRabun Gap-Nacoochee SchoolAwardsYWAG Prize for Gambian Literature Tijan M. Sallah (born 6 March 1958) is a Gambian poet and prose writer.[1] Early life Tijan Sallah was born in Serekunda, The Gambia, on 6 March 19...

 

 

Strategi Solo vs Squad di Free Fire: Cara Menang Mudah!