SlideShare una empresa de Scribd logo
1 de 34
06/21/11 UPDATES Isa Ansharullah
06/21/11 PROCESS in LINUX ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Linux Kernel Development, Robert Love p.25
06/21/11 <include/sched.h>  struct task_struct  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
06/21/11 PROCESS’ STACKS ,[object Object],[object Object],[object Object],[object Object],[object Object]
06/21/11 Process’ Kernel Stack (1) ,[object Object],[object Object]
06/21/11 Process’ Kernel Stack (2) Professional Linux Kernel Architecture, Wolfgang Mauer p.71 task_struct  is  referenced via  thread_info   structure at the bottom of kernel stack (to provide fast access)
06/21/11 PROCESS DUPLICATION ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
06/21/11 Copy-on-write ,[object Object],[object Object],[object Object]
06/21/11 FORKING PROCESS fork() clone() do_fork() defined in <kernel/fork.c> architecture-independent copy_process() The actual work of duplicating process Takes several flags about resources sharing, etc. If new child is returned successfully, The new child is woken up and run.  In the common case, child will call exec() immediately, thus no overhead cost on copying. Thanks to Copy-on-write .
06/21/11 <kernel/fork.c >  copy_process() Creates a new kernel stack,  task_struct, thread_info struct- tures similar to its parent’s Copy/Share resources Professional Linux Kernel Architecture, p73 Professional Linux Kernel Architecture, p68
06/21/11 PROCESS vs THREAD ,[object Object],[object Object],[object Object],[object Object],clone ( CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, 0)
06/21/11 Questions (06/13/11) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
06/21/11 Allocating Process Descriptors ( task_struct ) ,[object Object],[object Object],[object Object],[object Object],Understanding Linux Kernel (3rd Edition)
06/21/11 Slab allocator & Buddy Allocator ,[object Object],[object Object],[object Object],[object Object],Takuo Watanabe, Operating System Lecture slide, “Buddy System”
The Slab Allocator ,[object Object],[object Object],07/04/11 Proposed by Jeff Bonwick (Sun Micro), read  The Slab Allocator: An Object-Caching Kernel Memory Allocator  (google it!) Kernel objects : inode structure, task_struct, vm_area_struct etc..
06/21/11 Not only  task_struct ... ( from kernel/fork.c ) many structures are also allocated using the slab allocator
Basis ,[object Object],[object Object],[object Object],07/04/11
Overview 07/04/11 The memory is organized in caches ,  one cache for each object type.  (e.g. inode_cache, dentry_cache, buffer_head, vm_area_struct)  .  Each cache consists out of many slabs  (they are small (usually one   page long) and always contiguous), and  each slab contains multiple   initialized objects. From  linux/mm/slab.c   header comment :
include/linux/slab_def.h |  struct kmem_cache 07/04/11 struct kmem_cache { struct array_cache *array[NR_CPUS]; unsigned int batchcount; unsigned int limit; unsigned int shared; unsigned int buffer_size; u32 reciprocal_buffer_size; unsigned int flags; unsigned int num; unsigned int gfporder; gfp_t gfpflags; size_t colour; unsigned int colour_off; struct kmem_cache *slabp_cache; unsigned int slab_size; unsigned int dflags; void (*ctor) (void *obj); const char *name; struct list_head_next; struct kmem_list3 *nodelists[MAX_NUMNODES]; }
06/21/11 /proc/slabinfo  - seeing the caches from : isa’s personal VPS @ webbynode.com
06/21/11 From allocating to freeing (1) ,[object Object],[object Object]
06/21/11 kernel/fork.c |  dup_task_struct() ( continues.. )
06/21/11 From allocating to freeing (2) ,[object Object],[object Object],[object Object],[object Object],[object Object]
06/21/11 Slob & Slub allocators  (not yet covered) ,[object Object],[object Object]
This week’s Updates ,[object Object]
The Buddy Allocator  (mm/page_alloc.c) ,[object Object],[object Object],[object Object],[object Object]
Basics ,[object Object],[object Object],[object Object],[object Object]
cat /proc/buddyinfo order Showing available memory blocks in each zones 0 1 2 3 4 5 6 7 8 9 10
Example| Allocating 256 page (1MB) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Freeing page ,[object Object],[object Object],[object Object],[object Object]
Disadvantage ,[object Object],[object Object],[object Object]
Process’s Address Space ,[object Object],[object Object],[object Object],[object Object],[object Object]
/bin/gonzo’s address space http://duartes.org/gustavo/blog/post/how-the-kernel-manages-your-memory
pmap <pid> Linux kernel Development, Robert Love p.314 library ELF library

Más contenido relacionado

La actualidad más candente

Vmfs support features of dfl de data recovery tool
Vmfs support features of dfl de data recovery toolVmfs support features of dfl de data recovery tool
Vmfs support features of dfl de data recovery tool
Dolphin Data Lab
 
Coordinating Metadata Replication: Survival Strategy for Distributed Systems
Coordinating Metadata Replication: Survival Strategy for Distributed SystemsCoordinating Metadata Replication: Survival Strategy for Distributed Systems
Coordinating Metadata Replication: Survival Strategy for Distributed Systems
Konstantin V. Shvachko
 
Introduction to Bacula
Introduction to BaculaIntroduction to Bacula
Introduction to Bacula
Hemant Shah
 

La actualidad más candente (14)

Vmfs support features of dfl de data recovery tool
Vmfs support features of dfl de data recovery toolVmfs support features of dfl de data recovery tool
Vmfs support features of dfl de data recovery tool
 
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OSPractical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
 
Dbm 438 Enthusiastic Study / snaptutorial.com
Dbm 438 Enthusiastic Study / snaptutorial.comDbm 438 Enthusiastic Study / snaptutorial.com
Dbm 438 Enthusiastic Study / snaptutorial.com
 
Gg steps
Gg stepsGg steps
Gg steps
 
CloverETL + Hadoop
CloverETL + HadoopCloverETL + Hadoop
CloverETL + Hadoop
 
The structure of process
The structure of processThe structure of process
The structure of process
 
T isv-tru64-oracle10g-htts-1.0
T isv-tru64-oracle10g-htts-1.0T isv-tru64-oracle10g-htts-1.0
T isv-tru64-oracle10g-htts-1.0
 
ch17
ch17ch17
ch17
 
Coordinating Metadata Replication: Survival Strategy for Distributed Systems
Coordinating Metadata Replication: Survival Strategy for Distributed SystemsCoordinating Metadata Replication: Survival Strategy for Distributed Systems
Coordinating Metadata Replication: Survival Strategy for Distributed Systems
 
Memory
MemoryMemory
Memory
 
Data Structures used in Linux kernel
Data Structures used in Linux kernel Data Structures used in Linux kernel
Data Structures used in Linux kernel
 
SKILLWISE-DB2 DBA
SKILLWISE-DB2 DBASKILLWISE-DB2 DBA
SKILLWISE-DB2 DBA
 
Presentation db2 best practices for optimal performance
Presentation   db2 best practices for optimal performancePresentation   db2 best practices for optimal performance
Presentation db2 best practices for optimal performance
 
Introduction to Bacula
Introduction to BaculaIntroduction to Bacula
Introduction to Bacula
 

Similar a Updates

Linux architecture
Linux architectureLinux architecture
Linux architecture
mcganesh
 
Linux internal
Linux internalLinux internal
Linux internal
mcganesh
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
mcganesh
 
ECECS 472572 Final Exam ProjectRemember to check the errat.docx
ECECS 472572 Final Exam ProjectRemember to check the errat.docxECECS 472572 Final Exam ProjectRemember to check the errat.docx
ECECS 472572 Final Exam ProjectRemember to check the errat.docx
tidwellveronique
 

Similar a Updates (20)

memory.ppt
memory.pptmemory.ppt
memory.ppt
 
Linux memorymanagement
Linux memorymanagementLinux memorymanagement
Linux memorymanagement
 
I/O System and Case Study
I/O System and Case StudyI/O System and Case Study
I/O System and Case Study
 
os
osos
os
 
Chapter 8 : Memory
Chapter 8 : MemoryChapter 8 : Memory
Chapter 8 : Memory
 
I/O System and Case study
I/O System and Case studyI/O System and Case study
I/O System and Case study
 
Vmfs
VmfsVmfs
Vmfs
 
I/O System and Case study
I/O System and Case studyI/O System and Case study
I/O System and Case study
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
 
Physical Memory Management.pdf
Physical Memory Management.pdfPhysical Memory Management.pdf
Physical Memory Management.pdf
 
Linux memory
Linux memoryLinux memory
Linux memory
 
Oracle11g notes
Oracle11g notesOracle11g notes
Oracle11g notes
 
Linux Survival Kit for Proof of Concept & Proof of Technology
Linux Survival Kit for Proof of Concept & Proof of TechnologyLinux Survival Kit for Proof of Concept & Proof of Technology
Linux Survival Kit for Proof of Concept & Proof of Technology
 
Linux internal
Linux internalLinux internal
Linux internal
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
 
Root file system for embedded systems
Root file system for embedded systemsRoot file system for embedded systems
Root file system for embedded systems
 
The building blocks of docker.
The building blocks of docker.The building blocks of docker.
The building blocks of docker.
 
kerch04.ppt
kerch04.pptkerch04.ppt
kerch04.ppt
 
Os
OsOs
Os
 
ECECS 472572 Final Exam ProjectRemember to check the errat.docx
ECECS 472572 Final Exam ProjectRemember to check the errat.docxECECS 472572 Final Exam ProjectRemember to check the errat.docx
ECECS 472572 Final Exam ProjectRemember to check the errat.docx
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 

Updates

  • 1. 06/21/11 UPDATES Isa Ansharullah
  • 2.
  • 3.
  • 4.
  • 5.
  • 6. 06/21/11 Process’ Kernel Stack (2) Professional Linux Kernel Architecture, Wolfgang Mauer p.71 task_struct is referenced via thread_info structure at the bottom of kernel stack (to provide fast access)
  • 7.
  • 8.
  • 9. 06/21/11 FORKING PROCESS fork() clone() do_fork() defined in <kernel/fork.c> architecture-independent copy_process() The actual work of duplicating process Takes several flags about resources sharing, etc. If new child is returned successfully, The new child is woken up and run. In the common case, child will call exec() immediately, thus no overhead cost on copying. Thanks to Copy-on-write .
  • 10. 06/21/11 <kernel/fork.c > copy_process() Creates a new kernel stack, task_struct, thread_info struct- tures similar to its parent’s Copy/Share resources Professional Linux Kernel Architecture, p73 Professional Linux Kernel Architecture, p68
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16. 06/21/11 Not only task_struct ... ( from kernel/fork.c ) many structures are also allocated using the slab allocator
  • 17.
  • 18. Overview 07/04/11 The memory is organized in caches , one cache for each object type. (e.g. inode_cache, dentry_cache, buffer_head, vm_area_struct) . Each cache consists out of many slabs (they are small (usually one page long) and always contiguous), and each slab contains multiple initialized objects. From linux/mm/slab.c header comment :
  • 19. include/linux/slab_def.h | struct kmem_cache 07/04/11 struct kmem_cache { struct array_cache *array[NR_CPUS]; unsigned int batchcount; unsigned int limit; unsigned int shared; unsigned int buffer_size; u32 reciprocal_buffer_size; unsigned int flags; unsigned int num; unsigned int gfporder; gfp_t gfpflags; size_t colour; unsigned int colour_off; struct kmem_cache *slabp_cache; unsigned int slab_size; unsigned int dflags; void (*ctor) (void *obj); const char *name; struct list_head_next; struct kmem_list3 *nodelists[MAX_NUMNODES]; }
  • 20. 06/21/11 /proc/slabinfo - seeing the caches from : isa’s personal VPS @ webbynode.com
  • 21.
  • 22. 06/21/11 kernel/fork.c | dup_task_struct() ( continues.. )
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28. cat /proc/buddyinfo order Showing available memory blocks in each zones 0 1 2 3 4 5 6 7 8 9 10
  • 29.
  • 30.
  • 31.
  • 32.
  • 33. /bin/gonzo’s address space http://duartes.org/gustavo/blog/post/how-the-kernel-manages-your-memory
  • 34. pmap <pid> Linux kernel Development, Robert Love p.314 library ELF library