Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

cpu_need_resched(9) [netbsd man page]

CPU_NEED_RESCHED(9)					   BSD Kernel Developer's Manual				       CPU_NEED_RESCHED(9)

NAME
cpu_need_resched -- context switch notification SYNOPSIS
#include <sys/cpu.h> void cpu_need_resched(struct cpu_info *ci, int flags); DESCRIPTION
The cpu_need_resched() function is the machine-independent interface for the scheduler to notify machine-dependent code that a context switch from the current LWP, on the cpu ci, is required. This event may occur if a higher priority LWP appears on the run queue or if the current LWP has exceeded its time slice. If RESCHED_KPREEMPT flag is specified in flags and __HAVE_PREEMPTION C pre-processor macro is defined in <machine/intr.h>, machine-dependent code should make a context switch happen as soon as possible even if the cpu is running the kernel code. If RESCHED_IMMED flag is specified in flags, machine-dependent code should make a context switch happen as soon as possible. In that case, for example, if ci is not the current processor, cpu_need_resched() typically issues an inter processor call to the processor to make it notice the need of a context switch as soon as possible. Typically, the cpu_need_resched() function will perform the following operations: o Set a per-processor flag which is checked by userret(9) when returning to user-mode execution. o Post an asynchronous software trap (AST). o Send an inter processor interrupt to wake up cpu_idle(9). SEE ALSO
sched_4bsd(9), userret(9) BSD
July 31, 2010 BSD

Check Out this Related Man Page

CPU_SWITCHTO(9) 					   BSD Kernel Developer's Manual					   CPU_SWITCHTO(9)

NAME
cpu_switchto -- machine-dependent LWP context switching interface SYNOPSIS
#include <sys/cpu.h> lwp_t * cpu_switchto(lwp_t *oldlwp, lwp_t *newlwp, bool returning); DESCRIPTION
The cpu_switchto() function saves the context of the LWP which is currently running on the processor, and restores the context of the LWP specified by newlwp. Remarks: 1. cpu_switchto() does not switch address spaces. 2. cpu_switchto() sets curlwp(9) to newlwp. If the architecture does non-interlocked adaptive mutex release, cpu_switchto() does an equivalent of membar_producer(3), before and after the modification of curlwp(9). 3. cpu_switchto() should be called at IPL_SCHED. When the function returns, the caller should lower the priority level as soon as possible. 4. cpu_switchto() might be called with spin mutexes held. The function takes the following arguments. oldlwp Specify the LWP from which the switch is going to be made, i.e., the calling LWP. If it was NULL, the context of the LWP currently running on this processor is not saved. newlwp Specify the LWP to which to switch. It must not be NULL. returning Only meaningful if the architecture implements fast software interrupts. If true, it indicates that oldlwp is a soft interrupt LWP that is blocking. It is a good indication that any kind of address space or user activity can be completely ignored. For example: ras_lookup(9), cache flushes, TLB wirings, adjusting lazy FPU state. All that is required is to restore the register state and stack, and return to the interrupted LWP. RETURN VALUES
The cpu_switchto() function does not return until another LWP calls cpu_switchto(). It returns the oldlwp argument of the cpu_switchto() which is called to switch back to our LWP. It is either a LWP which called cpu_switchto() to switch to us or NULL in case the LWP was exit- ing. SEE ALSO
membar_producer(3), swapcontext(3), intro(9), mutex(9), spl(9) BSD
June 2, 2011 BSD
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Vmstat

I have MATLAB INSTALLED IN MY SUN MACHINE >> WHENEVER I USE IT THE CPU USAGE SHOWS ABT 90% Seeing the vmstat shows that system calls and context switch counters reach a very high value . What are these counters ( Man pages do not give much info on that) .... The only thing i can make out that... (1 Reply)
Discussion started by: DPAI
1 Replies

2. SCO

SCO unix 5.0.7 (SMP)

I have a dell machine Dell 2600 PowerEdge it has two processor (intel Xeon ). Is there a path or a software that will work with SCO unix in order to enable second processor and how would i know that the second processor is active. Thanks a lot guys . (1 Reply)
Discussion started by: josramon
1 Replies

3. UNIX for Dummies Questions & Answers

Poor resourece allocation (multi-user system)

All, I am an intermediate user, and am running SAS on a nice Solaris machine. However, even when top says that no other programs are running, the machine will only give me 5-7% processor power. Is this a configuration problem with SAS or the way the server is configured? Is there any way I can... (3 Replies)
Discussion started by: dj_is
3 Replies

4. AIX

Problem with knlist in AIX 5.3 for Power5 processor

Hi all, I have a AIX 5.3 Installation on the Power5 processor. I am using the knlist API for getting the details of the CPU details like user cpu, kernel cpu, idle cpu and wait cpu. My code is working fine on other Installations of AIX like PowerPC_POWER4 but it is giving wrong values on Power5... (0 Replies)
Discussion started by: rajesht
0 Replies

5. UNIX for Dummies Questions & Answers

PC connection to an old UNIX machine

Hello folks, I've got a problem I've found to be quite difficult to solve. Recently I bought an old UNIX machine from the late eighties, a DIAB1100 with a Motorola 68K processor. I've used Linux for a while now, so I know the basics of that OS and thought it would be interesting to see a real... (8 Replies)
Discussion started by: tonyingesson
8 Replies

6. UNIX for Dummies Questions & Answers

How to find which machine ...

Hi friend, pls let me know .. 1)How to fine which UNIX machine Ex . whether it is 32 bit processor OR 64 bit processor .. 2) HP-ux is machine or Architectural ? pls replay as soon as possible .. Thanks.. (3 Replies)
Discussion started by: premnathk
3 Replies

7. Linux

Processsor and Kernel type.

If I upgrade my PII motherboard/processor to a Sempron Mobo/processor, do I *HAVE* to make another kernel, or can I still use my current 686 kernel? (0 Replies)
Discussion started by: akbar
0 Replies

8. Shell Programming and Scripting

tink of a machine having 32 cpu`s

hi, send ur comments for this machine , having such a no of cpu's ( output of cpuinfo file) processor : 0 vendor : GenuineIntel arch : IA-64 family : Itanium 2 model : 1 revision : 5 archrev : 0 features : branchlong cpu number : 0 cpu regs : 4... (6 Replies)
Discussion started by: useless79
6 Replies

9. Programming

Compiler considerations

Hi this is rather basic question but to answer and understand the problem nedded expert. compilers are OS dependent but OS may use any processor how the compilers are able to generate code for different processors just consider the below scenario: Compilers: dev... (5 Replies)
Discussion started by: MrUser
5 Replies

10. UNIX for Dummies Questions & Answers

Please Help I Can't Install Unix On My Machine

Hi everybody; How are you? I have a machine with these components motherboard Gigabyet processor Intel RAM Kingstone 1GB HDD Westerndigital 160GB DVD ASUS I use this machine for labs, I was running WinXP I am now taking one of Sun's exams, I formated the HDD and get... (3 Replies)
Discussion started by: katilina
3 Replies

11. UNIX for Dummies Questions & Answers

Check login details

As a root user i switch to a different user say "oratest". I would like to know the details like at what time did the switch ( su - oratest ) happen. Are there any logs to check this Thanks. (4 Replies)
Discussion started by: jjoy
4 Replies

12. Hardware

Sun W2100z bios update

Hi I have the above machine, which is exhibiting the classic cpu fan pulsing issue. It seems I need to apply a BIOS update to the machine, from a CD that was formerly a free download from Sun, but now Oracle has taken over you need a support contract to get it. This machine is now very out of... (4 Replies)
Discussion started by: ZaphodB
4 Replies

13. UNIX for Dummies Questions & Answers

Help for processor

hello Admins, how to find number of processor in unix machine. (2 Replies)
Discussion started by: vipinkumarr89
2 Replies

14. Programming

Segmentation fault in fopen when in write mode.

Hi All, Although this code is quite long but it does not require one to understand the logic of the code. I am trying to run this code on my Linux machine using gcc. But when this line is executed: output_pointer = fopen ( file_name , "w" );I get segmentation fault. I've been breaking my head... (17 Replies)
Discussion started by: shoaibjameel123
17 Replies

15. Solaris

Make and gmake issues

Hello I am working on a CPP code written for SUN CC 5.5 and make we used make to compile the code then it compilation went smooth now i am using gmake: I have a make file like this WSROOT=.. include $(WSROOT)/etc/wsmkinclude.common all: @for subdir in */Makefile; \ do \... (1 Reply)
Discussion started by: Revathi R
1 Replies