From owner-freebsd-hackers Fri Aug 6 7:55:43 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.xmission.com (mail.xmission.com [198.60.22.22]) by hub.freebsd.org (Postfix) with ESMTP id 717B314CF2 for ; Fri, 6 Aug 1999 07:55:37 -0700 (PDT) (envelope-from wes@softweyr.com) Received: from [204.68.178.39] (helo=softweyr.com) by mail.xmission.com with esmtp (Exim 2.12 #1) id 11ClOo-0002Mf-00; Fri, 6 Aug 1999 08:55:10 -0600 Message-ID: <37AAF74E.BEB770A9@softweyr.com> Date: Fri, 06 Aug 1999 08:55:10 -0600 From: Wes Peters Organization: Softweyr LLC X-Mailer: Mozilla 4.5 [en] (X11; U; FreeBSD 3.1-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: Mike Smith Cc: Arun Sharma , freebsd-hackers@FreeBSD.ORG Subject: Re: Excessive assembly code ? References: <199908060705.AAA00655@dingo.cdrom.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Mike Smith wrote: > > > > > I wonder if so much assembly code is really necessary for FreeBSD. One > > argument for minimal usage of assembly code is that it is easier to code > > non trivial algorithms in C. > > > > One such example is the scheduler. Since the decision about which process > > is going to run next is decided in assembly code, it is restricted to a > > relatively dumb algorithm of scanning the runqs and picking one. If the > > mechanism (i.e nuts and bolts of the context switch) is coded in assembly > > and the policy (which process to pick next) is done in C, the code would > > be much more maintainable, IMO. > > > > How do people feel about it here ? > > I've been studying this just recently. The "pick the next proc" code > really should be MI and written carefully in C, yes. But if you look > at the code surrounding it, for example, it needs some very careful > thought. > > Much of the assembly code actually in use is there for performance or > architecture-related reasons; in many cases if you were to rewrite in C > you would just end up with a lot of asm() macros... And the total amount we have now doesn't seem excessive. Historically, UNIX has usually had 2-3% of the code in assembly, I doubt we're over that. There are some things which are still *easier* to do in assembler, especially on an architecture with port-mapped I/O. -- "Where am I, and what am I doing in this handbasket?" Wes Peters Softweyr LLC http://softweyr.com/ wes@softweyr.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message