What EXACTLY Will You be Learning in Our Computer Science Program? Anthony K. H. Tung( 邓锦浩)...

Preview:

Citation preview

What EXACTLY Will You be Learning in Our Computer

Science Program?

Anthony K. H. Tung(邓锦浩)Associate Professor

Department of Computer Science

http://www.comp.nus.edu.sg/~atunghttp://www.renren.com/profile.do?id=313870900&_ua_flag=93w

Objective Okay, so you hear about the nice job prospects,

nice faculty members, nice environment, etc. by joining SOC, but what do you EXACTLY expect to learn in a Computer Science program?

Aim of this talk: Give you some example of the things you will

learn in SOC Explain to you why they are important and

how that will give you a broad and internationalized job prospects

Warning: I will be trying to explain ideas that you will learn within a semester using simple terms. Don’t get worried if you don’t completely understand now!

Agenda

What exactly is Computer Science? Is it just programming?

Examples of the things we learn in CS: Database: How to make data safe and consistent? Networking: How to we ensure reliable and efficient sending

of data? Information Retrieval: How to we find the mot important

pages on the Web? Machine Learning: How do we make machine find patterns

and learn? Optimization Algorithm: How do we optimize our resources?

Picking a course: Points for Consideration

What exactly is Computer Science?

Real World

Engineering

Biology

Chemistry

Physic

Mathematics

Computer Science (Storage and Compute)

Every fields involved converting part of the real world into a particular “language”, manipulating, computing and then putting the derived conclusion back into the real world.

Digital information

Decision, Actions, Computed Results

Computer vs Human Activities

Computers are modelled based on human! Human ‘s main activities?

Remembering (Storage) Thinking(Computation) Communicating(Transfer of information to additional

storage!) Example

Remember: 1 Pen=$8, 1 Pencil=$5. Need to buy 3 pens and 3 pencils

Computation: Need $8x3+$5x3=$39 Communicating: “Mum, I need $39!” Sub-consciously, we try to make computation and storage

efficient as well: compute total price as ($8+$5)*3 Computer Science aims to make computers store, compute

and transfer information in an efficient and reliable manner. Understanding how computers works means understanding how human work. Not always straightforward.

What exactly is the role of programming then?

Every discipline has it’s fundamental principles and practical implementation. However, no one is worried that they don’t have those foundations when they join EE, CE or any science program!Discipline Principles Implementation

Electrical Engineering

Properties of electrical components, how they can be connected etc.

Soldering various electrical parts together to perform certain functions etc.

Civil Engineering Properties of materials, architecture of transport systems etc.

Planning and scheduling how constructions can be done etc.

Bioinformatics Properties and principles of biological system

Design and implement experiments to verify hypothesis etc.

Computer Science

Principles and techniques for efficient and reliable information storage, computation and transfer

Computer programming

Core CS Areas

Algorithm & Theory Artificial Intelligence Computer Networks Database Systems Information Retrieval Parallel Computing Programming Languages Software Engineering Systems Security Visual Computing

only have time to talk about these 5

Core CS Areas

Algorithm & Theory Artificial Intelligence Computer Networks Database Systems Information Retrieval Parallel Computing Programming Languages Software Engineering Systems Security Visual Computing

Database Consistency

Name Account No.

Savings

XXX XXX XXXX

XXX XXX XXXX

Yapeng BC345 $100

XXX XXX XXXX

XXX XXX XXXX

XXX XXX XXXX

XXX XXX XXXX

Bank Database Yapeng Deposit $50

Read Record(Yapeng, BC345, $100)

Database Consistency

Name Account No.

Savings

XXX XXX XXXX

XXX XXX XXXX

Yapeng BC345 $150

XXX XXX XXXX

XXX XXX XXXX

XXX XXX XXXX

XXX XXX XXXX

Bank Database Yapeng Deposit $50

Read Record(Yapeng, BC345, $100)

Write Record(Yapeng, BC345, $150)

Very simple?

Database Consistency

Name Account No.

Savings

XXX XXX XXXX

XXX XXX XXXX

Yapeng BC345 $150

XXX XXX XXXX

XXX XXX XXXX

XXX XXX XXXX

XXX XXX XXXX

Database Yapeng Deposit $30

Read Record(Yapeng, BC345, $150)

Read Record(Yapeng, BC345, $150)

Now both Yapeng and his wife Wang Fei deposit money concurrently

Wang Fei Deposit $100

Database Consistency

Name Account No.

Savings

XXX XXX XXXX

XXX XXX XXXX

Yapeng BC345 $250

XXX XXX XXXX

XXX XXX XXXX

XXX XXX XXXX

XXX XXX XXXX

Database Yapeng Deposit $30

Read Record(Yapeng, BC345, $150)

Read Record(Yapeng, BC345, $150)

Wang Fei update record first

Wang Fei Deposit $100

Write Record(Yapeng, BC345, $250)

Database Consistency

Name Account No.

Savings

XXX XXX XXXX

XXX XXX XXXX

Yapeng BC345 $180

XXX XXX XXXX

XXX XXX XXXX

XXX XXX XXXX

XXX XXX XXXX

Database Yapeng Deposit $30

Read Record(Yapeng, BC345, $150)

Read Record(Yapeng, BC345, $150)

Follow by Yapeng’s update

Wang Fei Deposit $100

Write Record(Yapeng, BC345, $180)

They lost $100!

Database Consistency

Name Account No.

Savings

XXX XXX XXXX

XXX XXX XXXX

Yapeng BC345 $150

XXX XXX XXXX

XXX XXX XXXX

XXX XXX XXXX

XXX XXX XXXX

Database Yapeng Deposit $30

Read Record(Yapeng, BC345, $150)

Solution: add a lock, no others can access a record when it is locked

locked

Database Consistency

Name Account No.

Savings

XXX XXX XXXX

XXX XXX XXXX

Yapeng BC345 $150

XXX XXX XXXX

XXX XXX XXXX

XXX XXX XXXX

XXX XXX XXXX

Database Yapeng Deposit $30

Read Record(Yapeng, BC345, $150)

Read Record(Yapeng, BC345, $150)

Wang Fei Deposit $100

Solution: add a lock, no others can access a record when it is locked

locked

Database Consistency

Name Account No.

Savings

XXX XXX XXXX

XXX XXX XXXX

Yapeng BC345 $180

XXX XXX XXXX

XXX XXX XXXX

XXX XXX XXXX

XXX XXX XXXX

Database Yapeng Deposit $30

Read Record(Yapeng, BC345, $150)

Read Record(Yapeng, BC345, $150)

Wang Fei Deposit $100

Solution: add a lock, no others can access a record when it is locked

locked

Write Record(Yapeng, BC345, $180)

Read Record(Yapeng, BC345, $180)

Database Deadlock

Name Account No.

Savings

XXX XXX XXXX

XXX XXX XXXX

Yapeng BC345 $150

XXX XXX XXXX

Wang Fei BC987 $1000

XXX XXX XXXX

XXX XXX XXXX

Database

Read Record (Yapeng, BC345, $150)Read Record(Wang Fei, BC987,$1000)Write Record (Yapeng, BC345, $100)Write Record (Wang Fei, BC345, $1050)

Wang Fei Deposit $100

Now Yapeng want to transfer $50 to Wang Fei and Wang Fei want to transfer $100 to Yapeng

locked

Write Record(Yapeng, BC345, $180)

Read Record(Yapeng, BC345, $150)

Read Record(Wang Fei, BC987,$1000)Read Record (Yapeng, BC345, $150)Write Record (Yapeng, BC345, $250)Write Record (Wang Fei, BC345, $900)

Read Record(Wang Fei, BC987, $1000)

locked

Database Deadlock

Name Account No.

Savings

XXX XXX XXXX

XXX XXX XXXX

Yapeng BC345 $150

XXX XXX XXXX

Wang Fei BC987 $1000

XXX XXX XXXX

XXX XXX XXXX

Database

Read Record (Yapeng, BC345, $150)Read Record(Wang Fei, BC987,$1000)Write Record (Yapeng, BC345, $100)Write Record (Wang Fei, BC987, $1050)

Wang Fei Deposit $100

Both transactions cannot continue because they are holding each other’s record

locked

Write Record(Yapeng, BC345, $180)

Read Record(Yapeng, BC345, $150)

Read Record(Wang Fei, BC987,$1000)Read Record (Yapeng, BC345, $150)Write Record (Yapeng, BC345, $200)Write Record (Wang Fei, BC987, $900)

Read Record(Wang Fei, BC987, $1000)

locked

Consistency and Deadlock

The problem of inconsistency and deadlock does not apply only to database or just computer science in general. It happens anywhere. Computer Science though try to develop principles and techniques to avoid these problems

Example: Imagine a group of 10 people trying to work together on a project. Inconsistency: Outdate info being pass

around Deadline: Waiting for each other to

finish before continuing A person trained in CS will be able to

avoid these

Core CS Areas

Algorithm & Theory Artificial Intelligence Computer Networks Database Systems Information Retrieval Parallel Computing Programming Languages Software Engineering Systems Security Visual Computing

Computer Network

Jack Rose

Network

Long Message

Problem 1: Data Communication rely essentially on electronic signals which can be unreliable.

Computer Network

Jack Rose

Network

Long Message

Problem 1: Data Communication rely essentially on electronic signals which can be unreliable.

Computer Network

Jack Rose

Network

Long Message

Problem 1: Data Communication rely essentially on electronic signals which can be unreliable.

Breakdown!

Computer Network

Jack Rose

Network

Long Message

Problem 1: Data Communication rely essentially on electronic signals which can be unreliable.

Resend

Computer Network

Jack Rose

Network

Long Message

Problem 1: Data Communication rely essentially on electronic signals which can be unreliable.

Resend

Computer Network

Jack Rose

Network

Long Message

Problem 1: Data Communication rely essentially on electronic signals which can be unreliable.

Resend

Computer Network

Jack Rose

Network

Short 1

Solution: Break long message to shorter message, have intermediate router

Short 2Short 3

Computer Network

Jack Rose

Network

Short 1

Solution: Break long message to shorter message, have intermediate router

Short 2Short 3

Computer Network

Jack Rose

Network

Short 1

Solution: Break long message to shorter message, have intermediate router

Short 2

Short 3

Computer Network

Jack Rose

Network

Short 1

Solution: Break long message to shorter message, have intermediate router

Short 2

Short 3

Computer Network

Jack Rose

Network

Short 1

Solution: Break long message to shorter message, have intermediate router

Short 2

Short 3

“Short 2” Breakdown!

Computer Network

Jack Rose

Network

Short 1

Solution: Break long message to shorter message, have intermediate router

Short 3

Resend “Short 2” from second router!

Short 2

Computer Network

Jack Rose

Network

For more reliability, replicate short messages over many routes!

Short 2

Short 3 Short

2

Short 3

Short 1

Short 1

Computer Network

Jack

Rose

Network

For intensive application like video, duplicates are stored and shared between peers

Duplicate Video

Video Server

Duplicate Video

Obtain video

from and display the first frame

available

Duplicate Video

迅雷看看 越多人看越流畅 !

Chopping and Duplicate

Again, the principle of message chopping and duplicates sending are most critical in ensuring reliable and efficient network communication. They again can be applied anywhere.

Other things to be considered in network: Security: can someone impersonate

you? Can someone flood the network? Timeout: how long do I have to wait for

my message? Routing efficiency: where is the shortest

path?

Core CS Areas

Algorithm & Theory Artificial Intelligence Computer Networks Database Systems Information Retrieval Parallel Computing Programming Languages Software Engineering Systems Security Visual Computing

Algorithm: Packing a Ship

A ship that can carry 5kg of goods and there are 4 items with different weight and value to be carried. Which items will you carry to maximize the total values of items in the ship?

item weight value 1 2kg $12 2 1kg $10 3 3kg $20 4 2 kg $15

1kg

2kg 3kg 4kg 5kg

$0 $12 $12 $12 $12 1st item

$10 $12 $22 $22 $22 1st and 2nd item

$10 $12 $22 $30 $32 1st, 2nd and 3rd item

$10 $15 $25 $30 $37 All 4 items

Note that you understand this technique WITHOUT knowing how to program. This is a general principle for efficient computation.

Algorithm: Packing in 2D

Article 1: $100 Article 2: $150

Article 3: $50

Article 4: $200

How do we pack these articles into the newspaper to maximize profit?

Algorithm: Multiple Resources

Tasks

Machine

People Computers

Storage

Time Needed

Profit

Task 1

3 8 2 6 2 weeks

$10000

Task 2

2 3 5 4 1 weeks

$5000

Task 3

5 6 7 2 5 weeks

$10700

Task 4

1 2 1 7 7 weeks

$20000

Task 5

2 7 2 3 3 weeks

$6000

If you company have 7 machines, 15 people, 9 computers and 10 units of storage, what are the task you will take up to maximize profit?

Algorithm: Multiple Resources

One of our professor start a company that do such planning and NASA used it to schedule their MAR exploration!

http://www.friartuck.net/

Good news: you only need to learn to solve the first problem!

Core CS Areas

Algorithm & Theory Artificial Intelligence Computer Networks Database Systems Information Retrieval Parallel Computing Programming Languages Software Engineering Systems Security Visual Computing

Artificial Intelligence(Machine Learning)

Among various sub-fields in AI, machine learning play an important role in knowledge extractionN0. RISK

HISTORYCREDIT DEBT COLLATERAL INCOME

1. high bad high none 0 to 15k

2. high unknown high none 15 to 35k

3. moderate unknown low none 15 to 35k

4. high unknown low none 0 to 15k

5. low unknown low none over 35k

6. low unknown low adequate over 35k

7. high bad low none 0 to 15k

8. moderate bad low adequate over 35k

9. low good low none over 35k

10. low good high adequate over 35k

11. high good high none 0 to 15k

12. moderate good high none 15 to 35k

13. low good high none over 35k

14. high bad high none 15 to 35k

New Client: Credit=unknown, Debt=high, Collateral=none, Income=15 to 35k, Risk=???

Artificial Intelligence(Machine Learning)

Depending on the data given, machine learning (or data mining) is able to handle different prediction task: What treatment is more effective

for a patient? What customers will buy a product

if they receive an advertisement brochure?

Will the building collapse if we build it this way?

Core CS Areas

Algorithm & Theory Artificial Intelligence Computer Networks Database Systems Information Retrieval Parallel Computing Programming Languages Software Engineering Systems Security Visual Computing

Information Retrieval

Given a network of web pages that contain a keyword, which page should be ranked the highest?

Page A

Page C

Page B

Page D

Random Walk Model

1. randomly pick a page and output the page2. randomly follow a link and move to the page3. output the new page and goto 2.

Order: D

Information Retrieval

Given a network of web pages that contain a keyword, which page should be ranked the highest?

Page A

Page C

Page B

Page D

Random Walk Model

1. randomly pick a page and output the page2. randomly follow a link and move to the page3. output the new page and goto 2.

Order: D, C

Information Retrieval

Given a network of web pages that contain a keyword, which page should be ranked the highest?

Page A

Page C

Page B

Page D

Random Walk Model

1. randomly pick a page and output the page2. randomly follow a link and move to the page3. output the new page and goto 2.

Order: D, C, A,

Information Retrieval

Given a network of web pages that contain a keyword, which page should be ranked the highest?

Page A

Page C

Page B

Page D

Random Walk Model

1. randomly pick a page and output the page2. randomly follow a link and move to the page3. output the new page and goto 2.

Order: D, C, A, B,

Information Retrieval

Given a network of web pages that contain a keyword, which page should be ranked the highest?

Page A

Page C

Page B

Page D

Random Walk Model

1. randomly pick a page and output the page2. randomly follow a link and move to the page3. output the new page and goto 2.

Order: D, C, A, B, C

Information Retrieval

Given a network of web pages that contain a keyword, which page should be ranked the highest?

Page A

Page C

Page B

Page D

Random Walk Model

1. randomly pick a page and output the page2. randomly follow a link and move to the page3. output the new page and goto 2.

Order: D, C, A, B, C, A

Information Retrieval

Given a network of web pages that contain a keyword, which page should be ranked the highest?

Page A

Page C

Page B

Page D

Random Walk Model

1. randomly pick a page and output the page2. randomly follow a link and move to the page3. output the new page and goto 2.

Order: D, C, A, B, C, A

The more important pages always get visited more.

Google’s pagerank algorithm!

Application of Random Walk

Finding important proteins

Finding important people in a social network

Recap

Database Consistency and Deadlock

Network Chopping and Replicate

Algorithm Packing a Ship: Resource

Optimization Artificial Intelligence

Machine Learning, Automatic Prediction

Information Retrieval Random Walk: Google’s Pagerank

So what exactly is Computer Science? It is the science of efficient

information storage, information processing and information transfer

Information form the cornerstone of today’s human society

Concepts in computer science is NOT limited by technologies and can easily be applied in everyday ‘s life simply because computers are modelled after human

IT Trend

Processors are cheap and will become cheaper(multi-core processor, graphic cards)

Storage will be cheap but might not be fast Bandwidth will be growing What can we do with this?

Play more realistic games! Not exactly a joke since any technologies that speed up games

can speed up scientific simulation Smarter (more intensive) computation

ensuring that everyone can utilize IT Jobs will eventually belong to those that can

leverage on this trend

Job Market for CS

http://www.cccblog.org/2010/01/04/where-the-jobs-are/

What should you consider when choosing a course?

Your interest What type of person are you?

Stability: Technical High Risk, High Return: Business Travelling? CS is highly international People’s person? Good connection?

Technical Depth vs Generality Easy Come, Easy Go If everyone can score well, then you can

easily be replaced! Management?

Two ways: Build on interaction and connection or Build on your technical strength ( 学而优则士)

generality

Technical depth

low high

low

highArts, Business

EE, Civil Eng

Science

CS (SOC)

IS (SOC)

What is common among these leaders?

PM Lee Hsien Loong DPM Teo Chee Hean Shantanu Narayen Sergey Brin

They are all computer science trained!

Questions and Contact

atung@comp.nus.edu.sg http://www.comp.nus.edu.sg/

~atung http://www.renren.com/

profile.do?id=313870900&_ua_flag=93w

Recommended