lecture 9: personal computers - system hardware and software

49
2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 1 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.

Upload: laurie

Post on 17-Jan-2016

24 views

Category:

Documents


0 download

DESCRIPTION

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 - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 1

Lecture 9:

Personal Computers- System Hardware and Software

Raine Mäki, Reima SaarinenDept. of CSE, Helsinki University of Tech.

Sangjin HanDept. of EECS, Korea Advanced Institute of Sci. &

Tech.

Page 2: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 2

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

Page 3: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 3

System hardware

• System architectures• Processors (CPUs)• Main memory• Mass storage devices• Display devices• Graphics cards (GPUs)• Sound related devices• Other multimedia devices

Page 4: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 4

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

Page 5: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 5

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

Page 6: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 6

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)..

Page 7: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 7

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

Page 8: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 8

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

Page 9: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 9

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.

Page 10: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 10

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..)

Page 11: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 11

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?

Page 12: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 12

System software

• Operating systems Windows, Linux, Mac OS

• Multimedia APIs Windows API, GDI, DirectX, DirectFB,

OpenGL, SDL

• GUI toolkits Windows, X Window, Java, examples

Page 13: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 13

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)

Page 14: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 14

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.

Page 15: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 15

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

Page 16: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 16

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

Page 17: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 17

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)

Page 18: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 18

User Interface

• Windowing• Resources

Icons, cursors, menus...

• Common controls Buttons, text fields, edits, syslinks

(hypertext), scroll bars, list boxes...

• User input Keyboard, mouse...

Page 19: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 19

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

Page 20: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 20

Windows Multimedia

• A basic Windows library• Enables applications for example to play

sounds and video and to record sounds• Used in PlaySound example

Page 21: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 21

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

Page 22: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 22

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

Page 23: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 23

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

Page 24: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 24

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

Page 25: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 25

DirectX Example: Far Cry

Page 26: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 26

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

Page 27: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 27

DirectFB Example: Quake 3: Arena

Page 28: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 28

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

Page 29: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 29

OpenGL ES

• Royalty-free, cross-platform API for full-function 2D and 3D graphics on embedded systems Consoles Phones Appliances

Page 30: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 30

OpenGL Example:Homeworld 2

Page 31: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 31

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

Page 32: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 32

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.

Page 33: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 33

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

Page 34: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 34

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

Page 35: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 35

SDL Example:NetHack Falcon Eye

Page 36: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 36

GUI toolkits

• What is a GUI toolkit? (Widget toolkit) A set of basic building elements for

graphical user interfaces.

Widgets: GUI:

Page 37: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 37

For Windows

• Windows API A basis of all GUI toolkits on Windows

• MFC (Win32)• Windows Forms (.NET)

• OWL VCL CLX Of Borland

Page 38: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 38

For X Window System

• X doesn’t offer any common widgets. The reason why X applications look

different.

• Two major GUI toolkitsQT• Managed by Trolltech• Basis of KDE• C++

GTK+• GPL• Basis of GNOME• C (with an OOP

manner)• Originally for GIMP

Page 39: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 39

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

Page 40: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 40

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)

Page 41: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 41

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.

Page 42: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 42

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++

Page 43: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 43

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

Page 44: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 44

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

Page 45: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 45

PC vs. PlayStation2 (cont’d)

PC• Powerful CPU (x86)

1~3Ghz CISC 8 32bits GPRs

• 256MB ~ 1GB of RAM• Magnetic disks• A HW abstraction

layer is needed

PlayStation2• Poor CPU (EE)

200Mhz RISC (MIPS inst.) 32 128bits GPRs

• Many useful features for multimedia

• No compatability problem

• Hardware

Page 46: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 46

PC vs. PlayStation2 (cont’d)

PC• Various OS

Windows, Linux, etc.• Various MM APIs

DirectX, SDL, OpenGL, etc.

PlayStation2• No operating system

Runtime library only• No MM APIs

Must deal with HW directly

Some 3rd party libraries are available

• Software

Page 47: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 47

PC vs. PlayStation2 (cont’d)

PC• Plentiful programming

languages. Hundreds of!

• Various IDE and RAD tools

• So many references

PlayStation2• No option

ASM, C, C++• Notepad =)

CodeWarrior is available like other embedded systems.

• Seldom documents Confidential almost

• Development environment

Page 48: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 48

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/

Page 49: Lecture 9: Personal Computers - System Hardware and Software

2005-11-29 Raine Mäki, Reima Saarinen, Sangjin Han 49

Kiitos!