Share to: share facebook share twitter share wa share telegram print page

Processor affinity

Processor affinity, or CPU pinning or "cache affinity", enables the binding and unbinding of a process or a thread to a central processing unit (CPU) or a range of CPUs, so that the process or thread will execute only on the designated CPU or CPUs rather than any CPU. This can be viewed as a modification of the native central queue scheduling algorithm in a symmetric multiprocessing operating system. Each item in the queue has a tag indicating its kin processor. At the time of resource allocation, each task is allocated to its kin processor in preference to others.

Processor affinity takes advantage of the fact that remnants of a process that was run on a given processor may remain in that processor's state (for example, data in the cache memory) after another process was run on that processor. Scheduling a CPU-intensive process that has few interrupts to execute on the same processor may improve its performance by reducing degrading events such as cache misses, but may slow down ordinary programs because they would need to wait for that CPU to become available again.[1] A practical example of processor affinity is executing multiple instances of a non-threaded application, such as some graphics-rendering software. [citation needed]

Scheduling-algorithm implementations vary in adherence to processor affinity. Under certain circumstances, some implementations will allow a task to change to another processor if it results in higher efficiency. For example, when two processor-intensive tasks (A and B) have affinity to one processor while another processor remains unused, many schedulers will shift task B to the second processor in order to maximize processor use. Task B will then acquire affinity with the second processor, while task A will continue to have affinity with the original processor.[citation needed]

Usage

Processor affinity can effectively reduce cache problems, but it does not reduce the persistent load-balancing problem.[2] Also note that processor affinity becomes more complicated in systems with non-uniform architectures. For example, a system with two dual-core hyper-threaded CPUs presents a challenge to a scheduling algorithm.

There is complete affinity between two virtual CPUs implemented on the same core via hyper-threading, partial affinity between two cores on the same physical processor (as the cores share some, but not all, cache), and no affinity between separate physical processors. As other resources are also shared, processor affinity alone cannot be used as the basis for CPU dispatching. If a process has recently run on one virtual hyper-threaded CPU in a given core, and that virtual CPU is currently busy but its partner CPU is not, cache affinity would suggest that the process should be dispatched to the idle partner CPU. However, the two virtual CPUs compete for essentially all computing, cache, and memory resources. In this situation, it would typically be more efficient to dispatch the process to a different core or CPU, if one is available. This could incur a penalty when process repopulates the cache, but overall performance could be higher as the process would not have to compete for resources within the CPU.[citation needed]

Specific operating systems

On Linux, the CPU affinity of a process can be altered with the taskset(1) program[3] and the sched_setaffinity(2) system call. The affinity of a thread can be altered with one of the library functions: pthread_setaffinity_np(3) or pthread_attr_setaffinity_np(3).

On SGI systems, dplace binds a process to a set of CPUs.[4]

On DragonFly BSD 1.9 (2007) and later versions, usched_set system call can be used to control the affinity of a process.[5][6] On NetBSD 5.0, FreeBSD 7.2, DragonFly BSD 4.7 and later versions can use pthread_setaffinity_np and pthread_getaffinity_np.[7] In NetBSD, the psrset utility[8] to set a thread's affinity to a certain CPU set. In FreeBSD, cpuset[9] utility is used to create CPU sets and to assign processes to these sets. In DragonFly BSD 3.1 (2012) and later, usched utility can be used for assigning processes to a certain CPU set.[10]

On Windows NT and its successors, thread and process CPU affinities can be set separately by using SetThreadAffinityMask[11] and SetProcessAffinityMask[12] API calls or via the Task Manager interface (for process affinity only).

macOS exposes an affinity API[13] that provides hints to the kernel how to schedule threads according to affinity sets.

On Solaris it is possible to control bindings of processes and LWPs to processor using the pbind(1)[14] program. To control the affinity programmatically processor_bind(2)[15] can be used. There are more generic interfaces available such as pset_bind(2)[16] or lgrp_affinity_get(3LGRP)[17] using processor set and locality groups concepts.

On AIX it is possible to control bindings of processes using the bindprocessor command[18][19] and the bindprocessor API.[18][20]

See also

References

  1. ^ "Processor affinity and binding". IBM. Retrieved 2021-06-08.
  2. ^ "White Paper - Processor Affinity" - From tmurgent.com. Accessed 2007-07-06.
  3. ^ taskset(1) – Linux User Manual – User Commands
  4. ^ dplace.1 Archived 2007-07-01 at the Wayback Machine - From sgi.com. Accessed 2007-07-06.
  5. ^ "usched_set(2) — setting up a proc's usched". DragonFly System Calls Manual. DragonFly BSD. Retrieved 2019-07-28.
  6. ^ "kern/kern_usched.c § sys_usched_set". BSD Cross Reference. DragonFly BSD. Retrieved 2019-07-28.
  7. ^ pthread_setaffinity_np(3)NetBSD, FreeBSD and DragonFly BSD Library Functions Manual
  8. ^ psrset(8) – NetBSD System Manager's Manual
  9. ^ cpuset(1) – FreeBSD General Commands Manual
  10. ^ "usched(8) — run a program with a specified userland scheduler and cpumask". DragonFly System Manager's Manual. DragonFly BSD. Retrieved 2019-07-28.
  11. ^ SetThreadAffinityMask - MSDN Library
  12. ^ SetProcessAffinityMask - MSDN Library
  13. ^ "Thread Affinity API Release Notes". Developer.apple.com.
  14. ^ pbind(1M) - Solaris man page
  15. ^ processor_bind(2) - Solaris man page
  16. ^ pset_bind(2) - Oracle Solaris 11.1 Information Library - man pages section 2
  17. ^ lgrp_affinity_get(3LGRP) - Memory and Thread Placement Optimization Developer's Guide
  18. ^ a b Umesh Prabhakar Gaikwad; Kailas S. Zadbuke (November 16, 2006). "Processor affinity on AIX". IBM.
  19. ^ "bindprocessor Command". IBM.
  20. ^ "bindprocessor Subroutine". IBM.

Read other articles:

Celurut Niobe Crocidura niobe Status konservasiRisiko rendahIUCN41347 TaksonomiKerajaanAnimaliaFilumChordataKelasMammaliaOrdoEulipotyphlaFamiliSoricidaeGenusCrociduraSpesiesCrocidura niobe Thomas, 1906 DistribusiPersebaran celurut Niobe lbs Celurut Niobe (Crocidura niobe) adalah sebuah spesies mamalia dalam keluarga Soricidae. Spesies tersebut berasal dari hutan montana Albertine Rift. Referensi ^ Gerrie, R. & Kennerley, R. 2017. Crocidura niobe. The IUCN Red List of Threatened Species 2017:…

Ikan Sargassum Klasifikasi ilmiah Kerajaan: Animalia Filum: Chordata Kelas: Actinopterygii Ordo: Lophiiformes Famili: Antennariidae Genus: HistrioFischer, 1813 Spesies: H. histrio Nama binomial Histrio histrio(Linnaeus, 1758) Ikan Sargassum, Histrio histrio adalah ikan kodok pada famili Antennariidae dan genus Histrio. Ikan ini dapat ditemui di permukaan di antara sargassum yang mengapung di seluruh samudra subtropis. Ikan ini memiliki panjang hingga 20 cm. Referensi Froese, Rainer and…

Muhammad Thaib Bupati Aceh Utara ke-23Masa jabatan5 Juli 2012 – 14 Juli 2022PresidenSusilo Bambang YudhoyonoJoko WidodoGubernurIrwandi YusufNova IriansyahWakilFauzi Yusuf PendahuluIlyas A. HamidPenggantiAzwardi Abdullah (Pj.) Informasi pribadiLahir19 Januari 1961 (umur 63)Lhoksukon, Aceh Utara, AcehKebangsaanIndonesiaPartai politikPartai AcehSuami/istriCut Ratna Irawati, SEAnakYunita KeusumaKarier militerPihak Gerakan Aceh MerdekaMasa dinas1990—2005Pertempuran/perangPe…

Strada statale 423 UrbinateLocalizzazioneStato Italia Regioni Marche DatiClassificazioneStrada statale InizioPesaro FineUrbino Lunghezza31,120[1] km GestoreTratte ANAS: dal 2018 la strada è tornata all' ANAS dal km 10,530 al km 31,120 (da innesto con S.p. 127 a S.S. 73 Bis ad Urbino) Manuale La strada statale 423 Urbinate (SS 423), già strada provinciale 423 Urbinate (SP 423)[2] (ancora prima strada statale 423), è una strada statale italiana che collega Pesaro con U…

CircusAlbum studio karya Britney SpearsDirilis28 November 2008 (2008-11-28)GenrePopdanceDurasi46:15LabelJiveProduser Benny Blanco Bloodshy & Avant The Clutch Danja Dr. Luke Fernando Garibay K. Briscoe/The Outsyders Rob Knox Greg Kurstin Let's Go to War Max Martin Harvey Mason, Jr. Guy Sigsworth The Underdogs Kronologi Britney Spears Blackout(2007) Circus(2008) The Singles Collection(2009) Singel dalam album Circus WomanizerDirilis: 26 September 2008 CircusDirilis: 2 Desember 2008 If…

Kələbaq (juga Kələbağ) adalah sebuah desa si munisipalitas Rustov, Rayon Quba, Azerbaijan.[1] Referensi ^ Belediyye Informasiya Sistemi (dalam bahasa Azerbaijani). Diarsipkan dari versi asli tanggal September 24, 2008.  lbsRayon QubaIbu kota: Quba Adur Afurca Ağbil Alekseyevka Alıc Alpan Amsar Amsarqışlaq Aşağı Atuc Aşağı Tüləkəran Aşağı Xuç Ashagy Kharasha Atuc Aydınkənd Bad Bağbanlı Bağçalı Barlı Bərğov Birinci Nügədi Buduq Cadarı Cağacıq Çart…

The 1990–91 OHL season was the 11th season of the Ontario Hockey League. Sixteen teams each played 66 games. The Sault Ste. Marie Greyhounds won the J. Ross Robertson Cup, defeating the Oshawa Generals. The Detroit Compuware Ambassadors are granted a franchise. Expansion/Realignment Detroit Compuware Ambassadors On December 11, 1989, the Detroit Compuware Ambassadors were approved to join the league for the 1990–91 season as an expansion team. The club was owned by former Windsor Compuware S…

Part of a series onBritish law Acts of Parliament of the United Kingdom Year      1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879…

مدرسة علمية درميان مدرسه علمیه درمیان مدرسة علمية درميان معلومات الموقع الجغرافي المدينة درميان البلد  إيران تعديل مصدري - تعديل   مدرسة علمية درميان هي مدرسة تاريخية تعود إلى الدولة الأفشارية، وتقع في درميان.[1] مراجع ^ Encyclopaedia of the Iranian Architectural History. Cultural Heritage, Handicrafts a…

Satu Hati Sejuta CintaAlbum studio karya ArmadaDirilis18 April 2012GenrePop rock, Soft rock, Pop, Rock alternatif, Pop melayu, Power balladLabelE-Motion EntertainmentMusic Factory IndonesiaKronologi Armada Hal Terbesar(2009)Hal Terbesar2009 Satu Hati Sejuta Cinta (2012) Pagi Pulang Pagi (2014) Singel dalam album Satu Hati Sejuta Cinta Mabuk CintaDirilis: November 2011 Hargai AkuDirilis: Februari 2012 Pencuri HatiDirilis: September 2013 Apa Kabar SayangDirilis: Desember 2013 Pagi Pulang Pagi2…

National Historical Park of the United States United States historic placeCedar Creek and Belle Grove National Historical ParkU.S. National Register of Historic PlacesU.S. National Historic Landmark DistrictU.S. National Historical ParkVirginia Landmarks Register Cedar Creek and Belle Grove National Historical Park including the Belle Grove manor houseShow map of VirginiaShow map of the United StatesLocationFrederick, Shenandoah, and Warren counties, Virginia, USANearest cityMiddletown, Virginia…

Aircraft designer and pilot Edgar PercivalEdgar Percival with his Mew Gull, UK, 15 March 1934Born23 February 1897Albury, New South WalesDied21 January 1984(1984-01-21) (aged 86)London, United KingdomOccupation(s)AviatorDesigner Edgar Wikner Percival (23 February 1897 – 21 January 1984) was a noted Australian aircraft designer and pilot whose aircraft were distinguished by speed and grace. Percival went on to set up the Percival Aircraft Company, a British aircraft company. Early years Per…

Un cubo perfetto è un qualsiasi numero naturale la cui radice cubica corrisponde ad un numero intero. y=x³, per valori interi 1≤x≤25. In aritmetica e algebra, il cubo di un numero n è la sua terza potenza, cioè il risultato della moltiplicazione del numero per sé stesso tre volte: n3 = n × n × n. Si tratta anche della formula per calcolare il volume di un cubo il cui lato ha una lunghezza pari a n. Da qui il nome. La funzione inversa di trovare il numero il cui cubo è n è de…

2011 film Love.netOfficial poster in BulgariaDirected byIlian DjevelekovWritten byNelly DimitrovaMatey KonstantinovIlian DjevelekovProduced byMiramar FilmMatey KonstantinovIlian DjevelekovGeorgi DimitrovStarringHristo ShopovCinematographyEmil HristovEdited byAlexandra FuchanskaMusic byPetko ManchevDistributed byMiramar FilmRelease date 1 April 2011 (2011-04-01) Running time109 minutesCountryBulgariaLanguagesBulgarianEnglish Love.net is a 2011 Bulgarian drama film directed by Ilian…

RejikinoorS.Sos. Wakil Bupati Murung Raya ke-4PetahanaMulai menjabat 24 September 2018PresidenJoko WidodoGubernurSugianto SabranPendahuluDarmajiPenggantiPetahanaBupatiPerdie M. Yoseph Informasi pribadiLahir11 Februari 1970 (umur 54)Puruk Cahu, Kalimantan TengahKebangsaanIndonesiaPartai politikPPPSuami/istriSuhartiniAnak3Alma materUniversitas PGRI Palangka RayaPekerjaanpolitikus, birokratSunting kotak info • L • B Rejikinoor, S.Sos. (lahir 11 Februari 1970) adalah polit…

SMKN 5 PandeglangInformasiDidirikan2005[1]JenisNegeriAkreditasiBNomor Statistik Sekolah401280116014Nomor Pokok Sekolah Nasional20600569Kepala SekolahAhmad Zaenudin Anawar, M.PdModeratorJoeUniqueJumlah kelas24 kelasJurusan atau peminatan • RPL  • Akuntansi  • Teknik Kendaraan Ringan  • Pemasaran  • TKSDHRentang kelasX-XII RPL, X-XII Akuntansi , X-XII TKR, X-XI Pemasaran, X TKSDH,KurikulumKurikulum 2013Kurikulum Tingkat Satuan PendidikanJumlah&#…

Senyummu adalah TangiskuSutradaraDasri YacobProduserLeonita SutopoDitulis olehDasri YacobPemeranRano KarnoAnita Carolina MohedeFarida PashaRuslan BsrieAnna TairasSofia AmangSandra CiptadiSimon CaderZainal AbidinSukarno M. NoorPenata musikNuskan SyariefPenyuntingSK SyamsuriDistributorPT. Inem FilmTanggal rilis1980Durasi112 menitNegaraIndonesia Senyummu adalah Tangisku adalah film Indonesia tahun 1980 dengan disutradarai oleh Dasri Yacob dan dibintangi oleh Rano Karno dan Anita Carolina Mohe…

ملعب دورا الدوليمعلومات عامةالبلد  دولة فلسطين التشييد والافتتاحالافتتاح الرسمي 1965 المقاول الرئيسي المجلس الأعلى الفلسطيني للشباب والرياضة الاستعمالالمستضيف نادي شباب دورا المالك الاتحاد الفلسطيني لكرة القدم الإدارة المجلس الأعلى الفلسطيني للشباب والرياضة معلومات …

Politics of Barbados Constitution Human rights Executive President (list) Dame Sandra Mason Prime Minister (list) Mia Mottley Cabinet Ministries Legislature House of Assembly Speaker: Arthur Holder Senate President: Reginald Farley Leader Opposition Leader: Bishop Joseph J. S. Atherley Legislation Judiciary Caribbean Court of Justice Supreme Court Chief Justice: Marston Gibson Court of Appeal High Court Magistrates courts Barbados law Human rights Elections Recent elections General: 20182022Next…

Sant'Andrea degli Scozzesi Sant' Andrea degli Scozzesi (bahasa Indonesia: Santo Andreas dari orang-orang Skotlandia) adalah bekas gereja Katolik di Roma, dekat Piazza Barberini di Via delle Quattro Fontane. Pernah menjadi surga bagi Umat Katolik Skotlandia di Roma, gereja ini didekonsekrasi pada tahun 1962 dan masih berdiri sampai sekarang.[1] Sejarah Gereja ini dibangun di bawah Paus Klemens VIII pada tahun 1592 dengan judul S.Andrea e S.Margherita regina. Gereja ini dibangun untuk komu…

Kembali kehalaman sebelumnya