Re: MM and scheduling in SMP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2004-07-12 at 16:58, Anand wrote:
> Hi Folks,
> I have  few doubts on how memory is managed in Multi  Processor
> Systems(SMP)?

Symmetrical Multi Processing.

> Right now Linux uses 3G:1G split for a uniprocessor (Though patches are
> there for 32G)
> 
> 1) I was jus wondering how the 1G memory is managed on a SMP?
> Suppose i have a 1Gig RAM and 3 procesors (32 bit),Is the 1 Gig memory split
> among the 3 processors ??
> Since each processor can address 4G memory ,Do they have large Virtual
> Address space?

The memory is accessible by the 3 cpus, the word shared is more
appropriate.

> 2) How is the process switching taken care on SMP?
> (ie) on a UP when when a process time slice is over ,its context is saved in
> the PSW or the task_struct!
> and next time it gets its timeslice , it loads the info form the
> task_struct,
> but on a SMP, Assume i have 3 procesors ,In the first time slice the Process
> runs in Processor P1,
> Is it possible for the process to run in Processor P2 when it gets it time
> slice back ?
> If possibe how is it taken care?

Yes, a process doesn't have to stay on a particular cpu (unless you tell
it to). On x86 the user space context is saved on the start of the
kernel mode stack when entering the kernel mode (possibly through a
timer tick). On the way back to user space it checks if need_resched is
set, and if so will change to a new task. So there is no problem with
having tasks run on different cpus.

> 3)Does the Linux scheduler diffrenciates between a Process and a thread ?
> All i can see in the scheduler code is a the task represented by
> task_struct, which is getting scheduled,
> >From which i assume ,that  the scheduler schedules only the Process (coz
> task_struct represents a Process :-)!!)
> But how is the user space threads (which is part of a Process),Kernel treads
> scheduled ?

The scheduler sees things as tasks and nothing else, linux doesn't
really make a distinction here. Kernel threads are normal tasks that
execute in the kernel and they don't have their own mm_struct, they
borrow someone elses. "User space threads" are treated as tasks.

Hope this clears some up, I can recommend reading Robert Love's "Linux
kernel development"


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux