f



How does Linux partition logical address space as far as User/Kernel space is concerned, especially when it comes to deciding what gets mapped to virtual versus physical RAM?

The norm for a memory allocation scheme is to use physical memory before 
dumping the overflow to disk. However with Linux it's unique in that 
there's a set limit for user and kernel space (aka monolithic kernel). 
Which leads me to believe that the logical address space is set aside 
ahead of time. Meaning that if a person has 2GBs of physical RAM and 
chooses option 3GBs/1GBS of user/kernel space, that either 1GB of kernel 
space and 1GB of user space will be allocated to physical RAM; OR, 2 GBs 
of user space will go to physical RAM while the remaining 2 GBs (1 user, 
the other kernel) will be virtual. This seems rather asinine, so I 
hardly believe this is how it works.

It was also proposed to me that the system only considers how much it -
will- give to either user or kernel space. Meaning that at boot up, if a 
system only uses 2 MBs of Kernel space, only 2 MBs gets mapped from the 
the total available memory for Kernel space (as there's a cap). Also 
meaning that those first 2 MBs would be allocated to physical memory.  
Then as more would be requested more would be allocated for either user 
or kernel space, straight from physical memory, till it ran out. This 
sounds like a more solid schema, but at the same time it seems silly to 
do things on a first come, first serve basis. It seems more reasonable 
that it would partition each application such that each has some 
physical memory to work in, and then to use a memory map for anything 
additional to disk. 

So the question is, how does Linux delegate it's memory with regards to 
user/kernel space? Does Linux treat User/Kernel space just as a hard 
limit, allocating memory as it's needed until it hits the cap for a 
particular "type" of memory? Or does it preordain that kernel space will 
be in physical memory while user space will get the remainder, whether 
it be physical or not? Is there possibly another partitioning scheme, 
similar to the one I suggested above? 

I'm beginning to believe it's a simple tallying scheme, checking to see 
how much kernel space or user space has been allocated. 

ie/ 
3GB/1GB of User/Kernel space is available.
2 MBs gets allocated at boot-time for the kernel and it's modules -  
(1.000GBs-0.002GBs=NewAvailableKernelSpace)
50 MBs gets allocated to X in user space - (3.000GBs-
0.050GBs=NewAvailableUserSpace)
So on and so forth. 

I imagine that the logical address space is just a series of pointers 
telling the system where everything is. For example, the first logical 
address might point to physical memory for kernel space, while the 
second logical address unit might point to user space in virtual memory 
(similar to the example above). I imagine that's the whole value of 
logical address space - it provides the HAL. 

Any reference material or solid answers surrounding the mysteries of 
Linux's memory allocation would be appreciated. :)

Thanks,
Dustin
0
aktuld (1)
9/20/2003 8:24:50 PM
comp.os.linux 3406 articles. 0 followers. Post Follow

1 Replies
520 Views

Similar Articles

[PageSpeed] 15

Dustin Darcy wrote:

> Any reference material or solid answers surrounding the mysteries of
> Linux's memory allocation would be appreciated. :)

http://www.oreilly.com/catalog/linuxkernel2/
..
-- 
///    Michael J. Tobler: motorcyclist, surfer, skydiver,    \\\ 
\\\ and author: "Inside Linux", "C++ HowTo", "C++ Unleashed" ///
 \\\ http://pages.sbcglobal.net/mtobler/mjt_linux_page.html ///
"Most legislators are so dumb that they couldn't pour piss out 
of a boot if the instructions were printed on the heel."

0
mjtobler (725)
9/20/2003 11:27:33 PM
Reply:

Similar Artilces:

Synchronizing user space threads with kernel space in linux
I want to synchronize a user space thread to an external event that generates an interrupt. I thought of using the following approach: the ISR that treats the interrupt does a quick processing (such as data capture and buffering) and then sends data to the user space thread through a message queue or signals to the thread waiting on a semaphore and it gets the buffered data from shared memory or some similar mechanism. So far I haven't succeded in finding a way to do it. I've tryed to write a module which uses semaphores (<linux/sem.h>) but aparently there is no way to use SysV I...

Mapping multiple physical/system address virtual buffers into a single user-space virtual range.
My question is as follows: Suppose I have a number of driver-allocated buffers. How can I map them into a single contiguous user-space buffer. I guess I should build an MDL that describes the physical pages mapped for these buffers and call MmMapLockedPagesSpecifyCache(), but did someone do this in practice? There seems to be no function to add several different pages to an MDL. Thanks a lot in advance, Greg. Very bad idea. You expose kernel pool memory to user mode, which can cause security leaks. Why do such stange a thing? -- Maxim Shatskih, Windows DDK MVP...

logical address space vs physical address space
Hi Everyone, It is well known that logical address space and physical address space are different in case of execution time address binding memory management. I think this is what virtual memory management is based on, however, my doubt is what if i have a 32 bit machine with 5 GB RAM with an operating system and hardware support for supporting virtual memory management, (1) The physical address space is just 4 GB (2^32), hence it is correct that the last 1 GB of RAM will never be used? (2) In this case, wouldn't the logical address space and physical address space be the sam...

copying from user address space to kernel address space and viceversa
Guys, Can anyone tell me how the copying from user/kerenl to kernel/user address space works on a unix system? Can we get a page fault while doing this ? ...

[News] Linux Plumbers Conference is Coming, Linux May Merge Real-Time with Kernel Space (Trunk)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Traveling in real time ,----[ Quote ] | The Linux Plumbers Conference is happening for the second | time. The first was a great success - by most accounts, one | of the very best technical events of the year. Quite a bit | of serious work got done there, with effects being felt | throughout the development community. This year - which has | just sold out - looks to be just as good. `---- http://linux-foundation.org/weblogs/lwf/2009/09/17/traveling-in-real-time/ Recent Linux Plumbers Conference 2009 Announces Speakers and Conference Program ,----[ Quote ] | The Linux Plumbers Conference today announces the speakers and conference | program for the 2nd annual conference to be held September 23-25 in Portland, | Oregon immediately following LinuxCon Portland 2009. Both events will be held | at the Marriott Downtown Waterfront in Portland, home to one of the largest | Linux communities worldwide. `---- http://www.prweb.com/releases/linux/plumbers/prweb2768854.htm -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkq0AqYACgkQU4xAY3RXLo7vLACePUCe8bQjEIeUA20N5YBA5ohC 25oAoKVAS0BZJaR1Zyi0aGBlL1V6JCUp =qxQ3 -----END PGP SIGNATURE----- ...

Virtual memory
Hi, I m having some questions in Linux memory management. I m considering about 32 bit machine only. If you have a 512 MB of memory, how it is divided between kernel space and user space? What is the link between this division and 3GB userspace and 1 GB kernel space division. Is the 3G/1G division is for virtual memory? Is the total Virtual memory can be 4G only? I mean is it the maximum? Thanks in advance. regards SaranJothy SaranJothy wrote: > Hi, > I m having some questions in Linux memory management. > I m considering about 32 bit machine only. > If you...

linux kernel user space
I am developing a kernel module, and as to prevent a page fault from occuring when accessing data from user space, I need to copy it to kernel space. Or so I thought. Until I was told that the linux kernel is in user space, so doing that is unneeded and all that I need to do is just use access_ok() on the address before using the data to which the pointer points to. Is this correct? If not, how should I handle user space addresses? Also, I have heard that the syscall table can no longer be modified in 2.5? What is the validity of that? -- nethlek Mantorok Redgormor wrote: &g...

sock_register only available in kernel space or also in user space ? If only kernel space is there something equivalent ?
Hello, is sock_register only available in kernel space or can it be also used in user space to register a new socket ? If only kernel space, is there a equivalent function for doing this ? Or some kind of wrapper, so a user mode application can register a new socket via kernel ? Regards, Martin "Maurer Martin (CN MUC)" wrote: > > Hello, > > is sock_register only available in kernel space or can it be also used in > user space It can be used only in kernel mode. > to register a new socket ? That is not what it does accordin...

Mapping kernel virtual address to user virtual address
Hi I am writing a kernel module for Linux kernel 2.6. I am currently dynamically allocating memory in the kernel module using the "kmalloc" function call. I am basically DYNAMICALLY creating an array of structures in the kernel module. I then plan to fill this array of structures with data and export it to the user space. I tried using the "do_mmap" function to map the kernel virtual address to the user virtual address. However it fails i.e when I try accessing this memory region in the userspace I get a segmentation fault. Can someone please enlighten me about h...

accessing user-space addresses from kernel space and vice versa
Hi, my driver needs to share a memory buffer with a user process. This feature isn't really supported by the HP-UX. I tried several approaches: 1.User allocate shared memory segment via the shmat syscall. According to the documents, addresses from the shared memory segment are accessible from all processes and have space ID 0 which I thought would enable me to access this memory from the kernel. Unfortunately, this access caused a kernel crash. 2.The user-process sends a read request with the buffer, the driver using physio locks and maps it and pend the request until the sharing isn...

how linux maps system RAM to physical address
hi, i am trying to understand how linux maps system RAM to physical address. can you point me to the kernel source code that sets up the memory resource? PS on my embedded system, the system RAM doesn't start at physical address 0, and the physical address of the entire system RAM is not continguous; when i dump /proc/iomem, i see 2 entries for system RAM. there's an addresss gap between the 2 entries. ultimately, i am trying to use mmap to map all system RAM to user space virtual address, so the software needs how to obtain all physical addresses that are used by the ...

[News] More Drivers Come to Linux Kernel Space
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 JFL Peripheral Solutions Announces Linux® Drivers for Visioneer and Xerox® DocuMate® Scanners ,----[ Quote ] | JFL Peripheral Solutions, the leading | independent provider of scanner driver | development services and products, today | announced the availability of new Linux | drivers, for Visioneer and Xerox DocuMate | scanners, that expand the compatibility of | these scanners to Linux operating systems with | exclusive image processing technology. The new | standard SANE (Scanner Access Now Easy) driver | enables users t...

Linux, Linux, Linux
Hi, Interested in trying Linux? Well you came to comp.os.linux.advocacy for some reason, and you probably won't stay long. Here's a list of Linux distributions to choose from. Ubuntu http://www.ubuntu.com Newbie friendly and good support forums. SuSE http://www.novell.com/linux Pay for some support if you're not opposed to spending a little money. Fedora Core http://fedoraproject.org If you're more comfortable with your computer, try this one out. If you get frustrated, don't give up so easy. There is a wealth of information online for whichever distro you choose....

[News] Linux Kernel Space Gets More Windows Compatibility
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Linux Support For Microsoft's exFAT File-System ,----[ Quote ] | Introduced in Windows Vista Service Pack 1 and then last week as a Windows XP | update was exFAT. exFAT, or the Extended File Allocation Table, is | Microsoft's new file-system for use on mobile devices like large USB flash | drives. exFAT addresses the file-size and partition size limitations of | Microsoft's FAT32 file-system and brings other improvements to the table as | well, albeit it's proprietary. No read or write support for exFAT has yet to | enter th...

Does pthreads in Linux create user or kernel space threads?
Does pthreads in Linux create user or kernel space threads? There seems to be many pthreads implementations. How do I know which is the one installed on my linux box? Thanks Diwa On Oct 14, 5:45=A0am, Diwa <shettydiwa...@gmail.com> wrote: > Does pthreads in Linux create user or kernel space threads? As that term is normally understood, on typical modern UNIX systems, pthreads are kernel threads. That may or may not mean what you think it means. > There seems to be many pthreads implementations. > How do I know which is the one installed on my linux box? You could read the documentation that came with it or ask your vendor. On Linux, you may find getconf(_CS_GNU_LIBPTHREAD_VERSION) to be useful inside a program. From a shell prompt, try "getconf GNU_LIBPTHREAD_VERSION". DS On Oct 14, 8:52=A0am, David Schwartz <dav...@webmaster.com> wrote: > On Oct 14, 5:45=A0am, Diwa <shettydiwa...@gmail.com> wrote: > > > There seems to be many pthreads implementations. > > How do I know which is the one installed on my linux box? > > You could read the documentation that came with it or ask your vendor. > On Linux, you may find getconf(_CS_GNU_LIBPTHREAD_VERSION) to be > useful inside a program. From a shell prompt, try "getconf > GNU_LIBPTHREAD_VERSION". > Thanks David. On my 32 bit box, using getconf in shell gave me NPTL 0.60 On my 64 bit box, I got NPTL 2.4 ...

[News] Plymouth Coming Along Nicely in Linux Kernel Space
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Plymouth Gets Tighter Integration With GDM, X ,----[ Quote ] | For about two years now Red Hat has been | working on the Plymouth project to replace | RHGB with this graphical boot program that | leverages kernel mode-setting and other newer | Linux innovations to provide a clean, flicker- | free boot experience. Over the course of the | past few Fedora releases, Plymouth has | continued to pickup new features and is also | now being used by Mandriva. While Plymouth | already does a great job at mode-setting to | the display's native...

sending user defined signals from kernel space to user space
Hi all The linux version we are using is 2.4.We have requirement of running a state machine in kernel space .There are four states in the state machine namely. STATE_1,STATE_2, STATE_3 and STATE_4. We have requirement of sending four asynchronous notifications from kernel space to user space for each state change in the state machine. I am able to send two signals namely SIGUSR1 and SIGUSR2 from kernel space to user space for states STATE_1 and STATE_2 respectively. Can any one help me how can I send two more user defined signals from kernel space to user space for STATE_3 and STA...

mmap from user space to statically mapped IO address in kernel
Hi Guys, Have a particular problem without an solution yet ( after much googling). Hope somebody could throw some light. Thanks. We have a ARM11 based board supporting some custom ASIC. Have already ported linux kernel 2.6-23 onto it and able to boot and execute busybox on it. The ASIC's register's are memory mapped ( say physical address 0x40000000) We have particular requirement that the ASIC register space should be available to both kernel and user space. The best solution was to user 'ioremap' in kernel and 'mmap' in user space. This works but for t...

[News] Linux Kernel Space Gets More New Software, Drivers
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Linux Media Labs releases LM26415 driver for kernel 2.6.31 ,----[ Quote ] | LML26415 is PCI card for full resolution | (D1) analog video/audio input and output, | based on OpenCores PCI controller and | MG1264 (Dallas/Mobilygen) motion video | processor. `---- http://linuxpr.com/releases/11746.html Phoronix Test Suite 2.2 Further Expands The Linux Benchmarking Landscape ,----[ Quote ] | Continuing in the tradition of providing | feature-rich, quarterly updates to the | Phoronix Test Suite, Phoronix Media has | announced the immediate a...

[News] Linux Kernel Space Gets Heaps More Graphics Drivers
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Nearly Two Dozen X.Org Drivers Get Updated ,----[ Quote ] | In time for the X.Org 7.5 release (whenever that may come), David Airlie has | put out new driver releases for nineteen of the X.Org video drivers. These | aren't updates to the mainline ATI/AMD, Intel, or even NVIDIA drivers, but | some of the drivers for less common graphics hardware. `---- http://www.phoronix.com/scan.php?page=news_item&px=NzQyMg Recent: S3 Graphics Releases Linux Driver With OpenGL 3.0, VA-API ,----[ Quote ] | For months we have seen S3 Graphics a...

[News] [Linux] Sun is Hunting for Linux Servers, But Keeps Losing Space to Linux
Sun Microsystems launches new Enterprise Services Plan ,----[ Quote ] | Sun is striving to establish its Solaris Unix operating system as | an alternative to Linux. Unlike other vendors, Sun promotes its | version of Unix as an open, non-hardware-aligned platform. `---- http://www.ovum.com/news/euronews.asp?id=5856#2944171340830618264 It has just lost to Linux again. Burbank Gets Higher Performance In Move To Blade Servers ,----[ Quote ] | Other advantages were inherent in the blade server architecture. For | one, applications that ran on Solaris were consolidated on to a Linux | bla...

[News] New NVIDIA Driver Comes to Kernel Space (Linux)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 nVidia Linux Display Driver - 185.18.14 ,----[ Quote ] | Release Highlights | | * Improved compatibility with recent Linux kernels. | * Fixed a Xinerama drawable resource management problem that can cause | GLXBadDrawable errors in certain cases, such as when Wine applications are | run. | * Fixed XineramaQueryScreens to return 0 screens instead of 1 screen with the | geometry of screen 0 when XineramaIsActive returns false. This conforms to | the Xinerama manual page and fixes an interaction problem with Compiz when | there is more than...

Web resources about - How does Linux partition logical address space as far as User/Kernel space is concerned, especially when it comes to deciding what gets mapped to virtual versus physical RAM? - comp.os.linux

Trump holds narrow lead over Kasich in Ohio
A poll published Monday by PPP shows Trump holding a narrow lead over Governor John Kasich, but with 31% of respondents saying they haven’t made ...

How Erin Andrews Shook Off the Shadow of Victimhood and Silenced Her Critics After Horrifying Stalking ...
E! Online How Erin Andrews Shook Off the Shadow of Victimhood and Silenced Her Critics After Horrifying Stalking Experience E! Online Erin ...

Apple CEO Clashes With GOP Senator Over Encryption At Secretive Retreat
It was supposed to be a chummy weekend with GOP lawmakers and billionaires. Instead, Sen. Tom Cotton (R-Ark.) got into it with Apple CEO Tim ...

Zac Efron’s Tan Sprayer Is Your New Dream Job; Bette Midler Takes Down Kim Kardashian Once And For All ...
Few things are more gratifying than following Bette Midler on Twitter. The Divine One’s latest target is once again America’s most annoying celeb ...

Peyton Manning jokes, chokes up during retirement remarks
ENGLEWOOD, Colo. (AP) — Peyton Manning got through the weekend thanks to hundreds of texts and calls from men he played against or alongside ...

North Korea's weak auto industry just received another blow
A new round of sanctions recently passed by Congress could deal another blow to North Korean carmakers. The sanctions target industries and ...

Google Project Fi free to join, but will seem expensive outside USA
Project Fi, the Google mobile phone service, no longer needs an invitation to join. And in an aggressive pricing move, Google is slashing the ...

The Walking Dead: That Awkward Moment When Rick’s Group Think Taking Out The Saviors Will Be Just Another ...
Episode 12 (entitled Not Tomorrow Yet”) of Season 6 of AMC’s The Walking Dead taught Rick’s group a very valuable lesson: Negan is not just another ...

Microsoft ends work on 'Fable Legends' video game
Microsoft on Monday announced it has stopped work on the long-delayed "Fable Legends" action video game and is mulling the closure of the British-based ...

Tunisia: At least 53 dead in clashes near Libyan border
Chicago Tribune Tunisia: At least 53 dead in clashes near Libyan border Chicago Tribune A Tunisian soldier stands on a sandbank during a presentation ...

Resources last updated: 3/8/2016 2:14:04 AM