Jump to content

Engine (computer science)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Dozinginovels (talk | contribs) at 05:37, 26 October 2011 (External links). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

An engine is a continuation-based construct that provides timed preemption. Engines which can contain other engines are sometimes called nesters and engines which don't have this ability are then called flat engines. To implement timed preemption there needs to be a clock. This clock can measure real time or simulated time. Simulated time can be implemented in a language like Scheme, by making each function start with decrementing the clock.

(define-syntax timed-lambda
  (syntax-rules ()
    ((_ formals exp1 exp2 ...)
     (lambda formals (decrement-timer) exp1 exp2 ...))))

Most engine subsystems can be implemented using different technologies, and better technologies can improve the performance of the engine. Let's look at all of the different subsystems used in modern engines, beginning with the valve train.The valve train consists of the valves and a mechanism that opens and closes them. The opening and closing system is called a camshaft. The camshaft has lobes on it that move the valves up and down.Most modern engines have what are called overhead cams. This means that the camshaft is located above the valves, as you see in Figure 5. The cams on the shaft activate the valves directly or through a very short linkage. Older engines used a camshaft located in the sump near the crankshaft. Rods linked the cam below to valve lifters above the valves. This approach has more moving parts and also causes more lag between the cam's activation of the valve and the valve's subsequent motion. A timing belt or timing chain links the crankshaft to the camshaft so that the valves are in sync with the pistons. The camshaft is geared to turn at one-half the rate of the crankshaft. Many high-performance engines have four valves per cylinder (two for intake, two for exhaust), and this arrangement requires two camshafts per bank of cylinders, hence the phrase "dual overhead cams." See How Camshafts Work for details. The ignition system (Figure 6) produces a high-voltage electrical charge and transmits it to the spark plugs via ignition wires. The charge first flows to a distributor, which you can easily find under the hood of most cars. The distributor has one wire going in the center and four, six, or eight wires (depending on the number of cylinders) coming out of it. These ignition wires send the charge to each spark plug. The engine is timed so that only one cylinder receives a spark from the distributor at a time. This approach provides maximum smoothness. See How Automobile Ignition Systems Work for more details.