Differences

This shows you the differences between two versions of the page.

Link to this comparison view

sesiuni:kernel:day-6 [2013/07/07 23:43] (current)
dbaluta created
Line 1: Line 1:
 +== Session 6: Kernel: Some bits of memory ==
 +
 +* [[http://​workshop.rosedu.org/​res/​kernel/​sesiune-06.pdf|Slides]]
 +
 +
 +<​html>​
 +<​center>​
 +<iframe src="​http://​docs.google.com/​viewer?​url=http://​workshop.rosedu.org/​res/​kernel/​sesiune-06.pdf&​embedded=true"​ width="​600"​ height="​470" ​  ​style="​border:​ none;"></​iframe>​
 +</​center>​
 +</​html>​
 +
 +== Tasks ==
 +
 +Download and unzip the tasks archive [[http://​workshop.rosedu.org/​res/​kernel/​sesiune-06-code.zip|sesiune-06]] on the virtual machine.
 +
 +# Memory limits (1)
 +#* Use the code in 1-mem/ directory and figure out the maximum chunk size that can be allocated using kmalloc.
 +#* Start by allocating a chunk of size 1K, and double the memory allocated at each iteration. Stop when kmalloc fails.
 +# Memory limits (2)
 +#* Use the code in 1-mem/ directory and figure out the maximum amount of memory that can be allocated in tne system.
 +#* Allocate memory chunks of 1K until the system gets Out of Memory.
 +# Memory caches
 +#* Check the code in 2-cache/ directory and see how memory caches are created. Following the example from ''​cache.c''​ allocate 2048 ''​penguin''​ objects.
 +#* Analyze the output for the following commands ''​slabtop''​ and ''​cat /​proc/​slabinfo''​ in respect with ''​penguin''​ structure.
 +# The curse of sleeping
 +#* Use the skeleton code from 3-context/ and fill in the code in context.c so that:
 +#** use ''​kmalloc''​ function with ''​GFP_KERNEL''​ flag, protect the allocation using a spin_lock.
 +#** use ''​kmalloc''​ function with ''​GFP_ATOMIC''​ flag, protect the allocation using a spin_lock.
 +#** replace ''​kmalloc''​ function with ''​schedule_timeout''​.
 +#Memory mappings
 +#* Use the skeleton code from 4-mmap/ and fill in the code in kmmap.c so that:
 +#** /dev/mmap has support for memory mapping
 +#** Implement function ''​my_map''​ in ''​kmmap.c''​. Use [[http://​lxr.linux.no/​linux+v3.4.4/​drivers/​video/​ps3fb.c#​L707 | mmap]] as an example.
 +#** Follow ''​TODO'​s''​ lines in ''​kmmap.c''​
 +#* Create an userspace program ''​mmap.c''​ that mmaps /​dev/​my_mmap and reads a page.
 +#* Check ''​mmap.c''​ memory mapped areas using ''​pmap''​.
  
sesiuni/kernel/day-6.txt · Last modified: 2013/07/07 23:43 by dbaluta