sched.h revision 107126
1104964Sjeff/*-
2104964Sjeff * Copyright (c) 2002, Jeffrey Roberson <jeff@freebsd.org>
3104964Sjeff * All rights reserved.
4104964Sjeff *
5104964Sjeff * Redistribution and use in source and binary forms, with or without
6104964Sjeff * modification, are permitted provided that the following conditions
7104964Sjeff * are met:
8104964Sjeff * 1. Redistributions of source code must retain the above copyright
9104964Sjeff *    notice unmodified, this list of conditions, and the following
10104964Sjeff *    disclaimer.
11104964Sjeff * 2. Redistributions in binary form must reproduce the above copyright
12104964Sjeff *    notice, this list of conditions and the following disclaimer in the
13104964Sjeff *    documentation and/or other materials provided with the distribution.
14104964Sjeff *
15104964Sjeff * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16104964Sjeff * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17104964Sjeff * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18104964Sjeff * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19104964Sjeff * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20104964Sjeff * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21104964Sjeff * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22104964Sjeff * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23104964Sjeff * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24104964Sjeff * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25104964Sjeff *
26104964Sjeff * $FreeBSD: head/sys/sys/sched.h 107126 2002-11-21 01:22:38Z jeff $
27104964Sjeff */
28104964Sjeff
29104964Sjeff#ifndef _SYS_SCHED_H_
30104964Sjeff#define	_SYS_SCHED_H_
31104964Sjeff
32104964Sjeff/*
33104964Sjeff * General scheduling info.
34104964Sjeff */
35104964Sjeffint	sched_rr_interval(void);
36104964Sjeffint	sched_runnable(void);
37104964Sjeff
38104964Sjeff/*
39104964Sjeff * KSE Groups contain scheduling priority information.  They record the
40104964Sjeff * behavior of groups of KSEs and threads.
41104964Sjeff */
42104964Sjeffvoid	sched_exit(struct ksegrp *kg, struct ksegrp *child);
43104964Sjeffvoid	sched_fork(struct ksegrp *kg, struct ksegrp *child);
44104964Sjeffvoid	sched_nice(struct ksegrp *kg, int nice);
45104964Sjeffvoid	sched_prio(struct thread *td, u_char prio);
46104964Sjeffvoid	sched_userret(struct thread *td);
47104964Sjeff
48104964Sjeff/*
49104964Sjeff * Threads are switched in and out, block on resources, and have temporary
50104964Sjeff * priorities inherited from their ksegs.
51104964Sjeff */
52104964Sjeffvoid	sched_clock(struct thread *td);
53104964Sjeffvoid	sched_sleep(struct thread *td, u_char prio);
54104964Sjeffvoid	sched_switchin(struct thread *td);
55104964Sjeffvoid	sched_switchout(struct thread *td);
56104964Sjeffvoid	sched_wakeup(struct thread *td);
57104964Sjeff
58104964Sjeff/*
59104964Sjeff * KSEs are moved on and off of run queues.
60104964Sjeff */
61104964Sjeffvoid	sched_add(struct kse *ke);
62104964Sjeffvoid	sched_rem(struct kse *ke);
63104964Sjeffstruct kse *sched_choose(void);
64104964Sjeff
65107126Sjeff/*
66107126Sjeff * These procedures tell the process data structure allocation code how
67107126Sjeff * many bytes to actually allocate.
68107126Sjeff */
69107126Sjeffint	sched_sizeof_kse(void);
70107126Sjeffint	sched_sizeof_ksegrp(void);
71107126Sjeffint	sched_sizeof_proc(void);
72107126Sjeffint	sched_sizeof_thread(void);
73107126Sjeff
74107126Sjeffextern struct ke_sched *kse0_sched;
75107126Sjeffextern struct kg_sched *ksegrp0_sched;
76107126Sjeffextern struct p_sched *proc0_sched;
77107126Sjeffextern struct td_sched *thread0_sched;
78107126Sjeff
79104964Sjeff#endif /* !_SYS_SCHED_H_ */
80