490 likes | 557 Views
Lecture 9: Personal Computers - System Hardware and Software. Raine Mäki, Reima Saarinen Dept. of CSE, Helsinki University of Tech. Sangjin Han Dept. of EECS, Korea Advanced Institute of Sci. & Tech. Overview of the presentation. System hardware
E N D
Lecture 9:Personal Computers- System Hardware and Software Raine Mäki, Reima Saarinen Dept. of CSE, Helsinki University of Tech. Sangjin Han Dept. of EECS, Korea Advanced Institute of Sci. & Tech.
Overview of the presentation • System hardware • A walkthrough of different multimedia related devices in PCs • System software • Operating systems • Multimedia APIs • GUI toolkits • Extra • Case Study: PC vs. PlayStation2
System hardware • System architectures • Processors (CPUs) • Main memory • Mass storage devices • Display devices • Graphics cards (GPUs) • Sound related devices • Other multimedia devices
System architectures • Basic CPU/memory/bus model is the most common system architecture • Uni/multi processor systems • One/many memory locations • Network systems (not really a PC anymore?) • Busses • PCI, AGP, PCI-E, IDE, SCSI.. • Main boards connect other components together and provide integrated functionalities
Processors (CPUs) • Mostly 32 or 64 bit systems • Only two big CPU manufacturers exist • Intel (Celeron, Pentium, Xeon..) • AMD (Sempron, Athlon, Opteron..) • Other CPUs (RISC, MIPS, Transmeta..) • Clock frequencies • MHz, GHz, FSB, multipliers.. • Multicore processors (virtually many CPUs) • Multilevel cache memory • L1, L2.. • Heat and power consumption is huge problem! • Mobile CPUs
Main memory • Main memory is usually RAM (Random Access Memory) • Loses its data if not constantly refreshed • Not as expensive as fast L1 and L2 level memories, but more expensive than magnetic mass storage memories • Technologies • DRAM, SIMM, DIMM, RIMM, DDR, DDR2 , SO-DIMM, ECC.. • Clock speeds (MHz) • e.g. 266, 333, 400, 500.. • FSB and latencies make the true speed • Memory sizes • Several MBs – a few GBs • 128, 256, 512, 1024 (1GB)..
Mass storage devices • Mainly magnetic and optical disks • Hard drives / disks • CDs, DVDs • Floppy disks (almost gone) • Other mass storage solutions • USB (flash) memories, CompactFlash cards etc.. • Tape drives • Capasities • From megas to hundreds of gigas • Speeds • Seek time • Rotational latency (rpm) • Bus speeds (MHz) • Magnetic disks exist only because main memory is expensive
Display devices • CRTs • CRTs’ era is almost over • Flat panels (LCD) • Are now cheap enough • Used to have latency issues • Still have view angle issues • Projectors (beamers) • Expensive • LCD and DLB technologies (Digital Light Processing) • Main properties of the devices • Colors they can show • e.g. 24bit (= 16M colors) • Max resolution they support • e.g. 1600x1200
Graphics cards (GPUs) • Graphics cards are like small computers themselves! • They process the frames that are to be drawn on the display device • Mainly two (chip) manufacturers dominate the market • ATI (Radeon) • Newest product family is the Radeon X1000-series • nVIDIA (GeForce) • E.g. the GeForce 7800-series • Main card components • Pixel and vertex shaders (processors) • Memory (e.g. GDDR) • AGP vs. PCI-E bus technologies • Heat, noise and power consumption are major problems • Two cards can be used the same time with GeForce SLI and ATI CrossFire technologies.
Sound related devices • Sounds are processed by a sound module that can be an: • Internal sound card • E.g. Sound Blaster Audigy & X-Fi • External sound peripheral • The best sound modules are usually external • Integrated sound “card” on the main board • E.g. AC’97 • Sounds are produced by speakers • E.g. 2, 2.1, 5.1 or 7.1 channel speaker • Sound quality comes from good hardware plus • High encoding bitrates and sample frequencies (e.g. 24bit, 48KHz..)
Other multimedia devices • There are a lot of different other multimedia related peripheral out there e.g. • TV-cards • I/O devices • mouse, keyboard, gamepad, joystick etc. • Networking hardware • Network, Bluetooth, USB, Firewire cards/modules • Webcams • Microphones • Is the next big thing the invention of a physics card that does the world modelling calculations?
System software • Operating systems • Windows, Linux, Mac OS • Multimedia APIs • Windows API, GDI, DirectX, DirectFB, OpenGL, SDL • GUI toolkits • Windows, X Window, Java, examples
Operating systems • Microsoft Windows • Most current version is XP (2001) • Next version is Vista • Now in Beta1 stage • Should be released in the end of next year (2006) • Windows is by far the most popular OS of today • Easy to use and learn • Supports almost all hardware there is • Because of popularity it has some security conserns • A massive system that requires new hardware to work • It sometimes causes BSoDs (Blue-Screens-of-Death)
Operating systems (cont’d) • Linux • A lot of different distributions (distros) available • Mandrake/Mandriva, Suse, Fedora, Debian, Red Hat, Xandros, Slackware, Ubuntu, etc.. • Most are freely downloadable from the Internet • Some distros cost money • By giving money you will get CDs, support services, user manuals etc. • A Unix type OS • Source code is available • Is stable and secure (at least some distros are) • A true multi-user environment • Not all programs or games are available in Linux • Because of lack of device drivers, not all hardware works with Linux.
Operating systems (cont’d) • Mac OS X • Current version of OS X is Tiger (10.4) • Previous one was Panther (10.3) • Macs and OS Xs are known to be used mainly by graphics artists and content producers • It’s easy to use and its usability is far better that other OSs. • Under the pretty outlook, it is still a Unix based OS • Macs look nice and trendy • Some could argue that Macs are not really PCs at all, because they are not that customizable
Multimedia APIs • This part introduces a few Multimedia Application programming Interfaces (APIs) • I'm going to consentrate on the Windows environment and especially on Windows API and DirectX • I'll also show a few code examples • I'm also going to tell shortly what are DirectFB, OpenGL (probably quite familiar already) and SDL • I'm trying to be a little practical so I'm not going to tell about the history of these APIs in detail • Everyone interested can search for more information from the internet or by using the provided links in the end
Windows API • Provides building blocks for applications that are written for Windows • Designed for C/C++ programmers • Familiarity with the Windows graphical user interface and message-driven architecture is required • Examples that Win API can be used to: • graphical user interfaces • display graphics and formatted text (GDI) • manage system objects such as memory, files, and processes • sounds and video (Windows Multimedia)
User Interface • Windowing • Resources • Icons, cursors, menus... • Common controls • Buttons, text fields, edits, syslinks (hypertext), scroll bars, list boxes... • User input • Keyboard, mouse...
Graphical Device Interface (GDI) • Used in most Windows applications to generate graphical output for video displays and printers • Can draw lines, curves, closed figures, paths, text, and bitmap images • Color and style depends on selected or created drawing objects: pens, brushes and fonts • GDI+ is improvement to GDI that optimizes existing features and adds for example gradient colors, alpha blending • Included in Windows XP and Windows Server 2003 (available to some earlier Windows’) • Also improves the API
Windows Multimedia • A basic Windows library • Enables applications for example to play sounds and video and to record sounds • Used in PlaySound example
DirectX • One of the most popular APIs in game development • Only works in Windows (and Xbox) • Provides APIs enabling software developers to access specialized hardware features without having to write hardware-specific code • Enables higher performance in graphics and sound when you’re playing games or watching video • Consists of many components that are meant for different kinds of tasks
DirectX 9.0 Main Components • DirectX Graphics component combines the Direct3D component and the D3DX utility library, which simplifies many graphics programming tasks • DirectInput component provides support for a variety of input devices, including full support for force-feedback technology • DirectSound component can be used in the development of high-performance audio applications that play and capture waveform audio
Old DirectX Components • DirectDraw handled all 2D drawing but it isn't available anymore and using it is no longer recommended • In DirectX 9.0 all 2D functionality is contained within Direct3D and its associated helper functions in D3DX • DirectDraw documentation is still available and can be viewed on MSDN • DirectMusic will maintain its current status until new technology is made available • DirectMusic documentation can be found at: <SDK Root>/Documentation/DirectX9
Old DirectX Components (cont'd) • DirectPlay is deprecated and Microsoft strongly recommends against using it to develop new applications • Game developers should use Windows Sockets and the Windows Firewall APIs • DirectShow is no longer recommended for game development • All of the DirectShow components were removed from the DirectX 9.0 SDK Update April 2005, but are available in the latest Platform SDK Install
DirectFB • Thin library that provides: • Hardware graphics acceleration • Input device handling and abstraction • Integrated windowing system and multiple display layers on top of the Linux Framebuffer Device • Supports GNU/Linux and FreeBSD, NetBSD, OpenBSD without accelation support • Support for Mac OS X is currenly worked on
OpenGL • Free environment for developing portable, interactive 2D and 3D graphics applications. • Since its introduction in 1992, OpenGL has become the industry's most widely used and supported 2D and 3D graphics API, bringing thousands of applications to a wide variety of computer platforms • Speeds application development by incorporating a broad set of rendering, texture mapping, special effects, and other powerful visualization functions • Many OpenGL extensions, as well as extensions to related APIs like GLU, GLX, and WGL, have been defined by vendors and groups of vendors
OpenGL ES • Royalty-free, cross-platform API for full-function 2D and 3D graphics on embedded systems • Consoles • Phones • Appliances
Simple DirectMedia Layer (SDL) • Cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL or DirectX and 2D video framebuffer • Used e.g. for games, emulators, demos, multimedia applications • Supports Linux, Windows, BeOS, MacOS Classic, MacOS X, FreeBSD, OpenBSD, BSD/OS, Solaris, IRIX, and QNX • Some unofficial support for Windows CE, AmigaOS, Dreamcast, Atari, NetBSD, AIX, OSF/Tru64, RISC OS, and SymbianOS
SDL (cont'd) • Written in C but works with C++ natively • Has bindings to several other languages, including Ada, Eiffel, Java, Lua, ML, Perl, PHP, Pike, Python, and Ruby • Currently available under the GNU Lesser General Public License (LGPL) version 2 or newer.
Using SDL • Initializing the library • Video • Choosing and setting video modes • Drawing pixels on the screen and loading and displaying images • Events • Waiting for events • Polling for events and event states
Using SDL (cont'd) • Audio • Opening the audio device • Loading and playing sounds • CD-ROM audio • Threads • Create a simple thread • Synchronizing access to a resource • Timers • Get the current time, in milliseconds • Wait a specified number of milliseconds
GUI toolkits • What is a GUI toolkit? (Widget toolkit) • A set of basic building elements for graphical user interfaces. GUI: Widgets:
For Windows • Windows API • A basis of all GUI toolkits on Windows • MFC (Win32) • Windows Forms (.NET) • OWL VCL CLX • Of Borland
For X Window System QT • Managed by Trolltech • Basis of KDE • C++ GTK+ • GPL • Basis of GNOME • C (with an OOP manner) • Originally for GIMP • X doesn’t offer any common widgets. • The reason why X applications look different. • Two major GUI toolkits
For Java • AWT • In early versions of Java • Direct mapping to native widgets • Heavyweight • Swing • Since Java 2 • Controls widgets by itself • Lightweight • Low-performance • SWT
Examples: How to make a GUI app? • Simple “Hello World” Programs on Windows using • Win32 api (Message-handling manner) • QT (Event-handling manner) • Windows Forms (IDE-integrated manner)
Hello World – (1) Win32 API • Tens of lines should be coded even for a simple application. • Message handling • When clicked, a WM_COMMAND message is passed.
Hello World – (2) QT • mywidget.h, mywidget.cpp, main.cpp • Event handling • By connecting clicked() signal to onClick() slot • Compilation • From extended C++ code to usual C++
Hello World – (3) Windows Forms • Using Visual Studio .Net, • IDE integrated GUI programming • Like other RAD tools such as Delphi, Borland C++ Builder, Visual Basic, etc. • Must be run on Microsoft .Net Framework
PC vs. PlayStation2 • What makes PCs different from other multimedia-dedicated devices? • Why PS2 games look nicer than PC games even today? • A case study with PlayStation2 versus
PC vs. PlayStation2 (cont’d) PlayStation2 Poor CPU (EE) 200Mhz RISC (MIPS inst.) 32 128bits GPRs Many useful features for multimedia No compatability problem • Hardware PC • Powerful CPU (x86) • 1~3Ghz • CISC • 8 32bits GPRs • 256MB ~ 1GB of RAM • Magnetic disks • A HW abstraction layer is needed
PC vs. PlayStation2 (cont’d) PlayStation2 No operating system Runtime library only No MM APIs Must deal with HW directly Some 3rd party libraries are available • Software PC • Various OS • Windows, Linux, etc. • Various MM APIs • DirectX, SDL, OpenGL, etc.
PC vs. PlayStation2 (cont’d) PlayStation2 No option ASM, C, C++ Notepad =) CodeWarrior is available like other embedded systems. Seldom documents Confidential almost • Development environment PC • Plentiful programming languages. • Hundreds of! • Various IDE and RAD tools • So many references
References • Windows API • http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/windows_api_start_page.asp • DirectX • Customers: http://www.microsoft.com/windows/directx/default.aspx • Developers: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/anch_directx.asp • DirectFB • http://www.directfb.org/ • OpenGL • http://www.opengl.org/ • OpenGL ES • http://www.khronos.org/opengles/ • Simple DirectMedia Layer • http://www.libsdl.org/