Return to Video

An Orientation to Cloud Computing (00:24:02)

  • 0:07 - 0:11
    Welcome, uh, to this, uh,
    cloud computing concepts course.
  • 0:11 - 0:14
    In this, uh, lecture we'll be
    covering several, uh, concepts,
  • 0:14 - 0:19
    uh, that are assumed
    as a part of, uh, the topics
  • 0:19 - 0:20
    that we'll be discussing
  • 0:20 - 0:22
    in the cloud computing concepts, uh, course.
  • 0:24 - 0:26
    So, we'll be covering several
    of the basics, uh,
  • 0:26 - 0:28
    they're considered to be basics
    in computer science.
  • 0:28 - 0:29
    Uh, typically,
  • 0:29 - 0:32
    some of these concepts,
    are concepts that, uh,
  • 0:32 - 0:34
    computer science students learn
    in their first couple of years
  • 0:34 - 0:36
    in, uh,
    a computer science degree,
  • 0:36 - 0:38
    undergraduate degree program.
  • 0:38 - 0:39
    So for those of you,
  • 0:39 - 0:41
    who are already familiar
    with this material,
  • 0:41 - 0:44
    uh, this could be a refresher
    or you could just, uh, skip it,
  • 0:44 - 0:46
    if you already know,
    uh, this stuff.
  • 0:46 - 0:49
    In any case, uh,
    you can always use this
  • 0:49 - 0:51
    orientation lecture
    as a reference,
  • 0:51 - 0:55
    uh, to keep coming back to if, you encounter a, uh, term in,
  • 0:55 - 0:58
    uh, during the regular lectures that doesn't make sense to you,
  • 0:58 - 0:59
    or that you'd like
    to be reminded about.
  • 1:01 - 1:03
    So, we'll discuss a few topics.
  • 1:03 - 1:04
    We'll discuss
    some basic data structures,
  • 1:04 - 1:06
    uh, what processes are.
  • 1:06 - 1:08
    We'll discuss a little bit about
    computer architecture,
  • 1:08 - 1:12
    and then, um, a little bit
    of math with Big O notation,
  • 1:12 - 1:13
    basic probability
  • 1:13 - 1:15
    and a few other
    miscellaneous topics.
  • 1:15 - 1:16
    So, let's get started here.
  • 1:17 - 1:19
    So, bas-basic data structures,
  • 1:19 - 1:20
    we'll discuss two di-different data structures.
  • 1:20 - 1:22
    The first one is a queue.
  • 1:22 - 1:23
    A queue, is essentially,
  • 1:23 - 1:25
    a First-in First-out
    data structure.
  • 1:25 - 1:28
    Elements of the queue could
    be, uh, any data types.
  • 1:28 - 1:31
    In this example, here, I have
    elements that are in tiers.
  • 1:31 - 1:35
    So, in this, uh, example right
    now, the queue has 5 elements,
  • 1:35 - 1:37
    3, 5, 8, 0, 7.
  • 1:37 - 1:40
    This is an ordered,
    list of elements.
  • 1:40 - 1:42
    When you remove an element
    from the queue,
  • 1:42 - 1:44
    you remove it from the head
    of the queue.
  • 1:44 - 1:46
    In this case, the head
    is the element three.
  • 1:46 - 1:48
    Uh, when you insert
    a new element,
  • 1:48 - 1:51
    you insert it in the tail
    of the queue, which means that,
  • 1:51 - 1:52
    if, I insert a new element,
    say one,
  • 1:52 - 1:55
    it's going to get inserted
    right after seven in this queue.
  • 1:56 - 1:58
    So removal always comes
    from the head,
  • 1:58 - 2:00
    while insertion always happens at the tail.
  • 2:00 - 2:03
    Uh, so, for instance,
    given this particular queue,
  • 2:03 - 2:05
    consisting of five elements,
    if you-if you,
  • 2:05 - 2:08
    dequeue or remove an item, uh, then that item will be three.
  • 2:08 - 2:10
    At that point of time
    the queue will only consist
  • 2:10 - 2:14
    of 5, 8, 0, and 7,
    with the head pointing to 5.
  • 2:14 - 2:17
    The next item that you dequeue
    or remove will be five, okay?
  • 2:17 - 2:20
    After that the queue will consist of only 8, 0, and 7.
  • 2:20 - 2:23
    Then, uh, the next item
    that you dequeue will be eight,
  • 2:23 - 2:26
    um, and so on and so forth.
  • 2:26 - 2:29
    Uh, dequeues and, or removals,
    as well as, insertions,
  • 2:29 - 2:32
    uh, can occur, uh,
    concurrently, so you can,
  • 2:32 - 2:33
    uh, remove an element,
  • 2:33 - 2:35
    but at the same time also insert an element at the tail.
  • 2:37 - 2:38
    So, that's a queue,
  • 2:38 - 2:40
    which is a First-in First-out data structure.
  • 2:40 - 2:42
    A different data structure
    is the stack,
  • 2:42 - 2:45
    which is the First-in Last-out data structure.
  • 2:45 - 2:47
    Uh, imagine a stack of dishes
    that you, uh,
  • 2:47 - 2:48
    place on your table.
  • 2:48 - 2:50
    Uh, the dish
    that you put on the top,
  • 2:50 - 2:51
    that you add the last,
  • 2:51 - 2:54
    will be the first one
    that you can remove, right?
  • 2:54 - 2:55
    And that's essentially a stack.
  • 2:55 - 2:59
    So, uh, remove or also known,
    as a pop happens from the top.
  • 2:59 - 3:01
    An insert or a push
    also happens at the top.
  • 3:01 - 3:05
    Okay, so in this case, um, uh, if you, uh, push a new element
  • 3:05 - 3:09
    into this particular stack,
    um, uh, say nine.
  • 3:09 - 3:10
    The nine will go above three.
  • 3:10 - 3:13
    After that, if you pop,
    or remove an element,
  • 3:13 - 3:14
    that's going to be
    the last element that you added,
  • 3:14 - 3:16
    which is nine, in this case.
  • 3:16 - 3:17
    The next pop after that
    will get three,
  • 3:17 - 3:19
    because nine was just removed.
  • 3:19 - 3:22
    And three is now the top
    of the, uh, stack.
  • 3:22 - 3:23
    Uh, after you've removed three,
  • 3:23 - 3:25
    the next pop or removal
    will get you five,
  • 3:25 - 3:27
    uh, and so on and so forth.
  • 3:27 - 3:29
    After that you'll get
    8 and then 0 and 7.
  • 3:29 - 3:31
    Okay, so, once again,
    the removal always returns you
  • 3:31 - 3:33
    the last item that was added.
  • 3:33 - 3:35
    And, uh, insertion or push
    adds an item
  • 3:35 - 3:38
    right to the top, of the stack.
  • 3:38 - 3:39
    So these two data structures,
    queue and stack
  • 3:39 - 3:41
    are used very widely
    in computer science
  • 3:41 - 3:44
    and, um, in fact, we'll be using the notion of a stack, uh,
  • 3:44 - 3:48
    right away when we'll discuss, uh, uh, processes, um,
  • 3:48 - 3:50
    uh, soon in this particular orientation lecture, itself.
  • 3:51 - 3:55
    So, speaking of processes, um,
    let's discuss a process next.
  • 3:55 - 3:59
    Uh, a process is essentially
    a program in action.
  • 3:59 - 4:01
    Uh, you may write a program
    in a language,
  • 4:01 - 4:03
    programming language,
    such as, C or C++.
  • 4:03 - 4:05
    And that's sh-
    an example is shown here.
  • 4:05 - 4:09
    This example code, here, uh,
    consists of a main function,
  • 4:09 - 4:12
    which, uh, calls a function,
    uh, called f1.
  • 4:12 - 4:14
    F1 itself has
    a local integer variable x,
  • 4:14 - 4:18
    and then, f1 itself calls
    a different function, f2.
  • 4:19 - 4:21
    Okay, this is shown
    pictorially here, in the circle,
  • 4:21 - 4:24
    where main calls f1
    and f1 calls f2.
  • 4:24 - 4:25
    'Kay, this is the code
    that you would write,
  • 4:25 - 4:26
    and then, y'know,
    you would compile the code
  • 4:26 - 4:28
    and then, uh, execute it.
  • 4:28 - 4:31
    And when you're executing it,
    when your program is in action,
  • 4:31 - 4:33
    that is a process.
  • 4:33 - 4:35
    So, a process consists
    of your code,
  • 4:35 - 4:39
    but also several other elements that, uh, help your code
  • 4:39 - 4:41
    to execute on the computer,
    on which you are executing it.
  • 4:41 - 4:43
    So, we are going
    to discuss some, uh, elements
  • 4:43 - 4:45
    o-of a process
    which are critical.
  • 4:46 - 4:48
    Here, are some
    of these elements.
  • 4:48 - 4:50
    First, um, uh,
    let's look at the code.
  • 4:50 - 4:52
    The code itself, uh,
    is, uh, static.
  • 4:52 - 4:55
    Once you write the code, um,
    nothing changes it,
  • 4:55 - 4:58
    uh, we are not considering
    the variable values
  • 4:58 - 4:59
    to be a part of the code.
  • 4:59 - 5:00
    I'll talk about that
    in a little bit.
  • 5:00 - 5:02
    But the code itself, is static;
  • 5:02 - 5:04
    it does not change
    once you write it.
  • 5:04 - 5:06
    Uh, but, uh,
    there is a program counter,
  • 5:06 - 5:08
    which is typically maintained
    by the computer
  • 5:08 - 5:11
    on which you're running your, uh, process, uh,
  • 5:11 - 5:12
    which points to
  • 5:12 - 5:14
    which is the line number
    inside the code,
  • 5:14 - 5:16
    where the program
    is currently executing,
  • 5:16 - 5:19
    or rather where, the process
    is currently executing.
  • 5:19 - 5:21
    'Kay, this is called
    a Program Counter, or the PC.
  • 5:21 - 5:22
    Okay, this is a part,
  • 5:22 - 5:24
    an important part
    of the process state.
  • 5:24 - 5:26
    So, if you were
    to take a core dump,
  • 5:26 - 5:27
    or stop the process right now,
  • 5:27 - 5:29
    and take a snapshot
    of that process.
  • 5:29 - 5:31
    That snapshot must include,
    the program counter,
  • 5:31 - 5:33
    because it says,
    where in the code is,
  • 5:33 - 5:35
    uh, the execution currently at.
  • 5:37 - 5:40
    Next, uh, when, um, er-r,
    um, functions call each other,
  • 5:40 - 5:45
    um, or in an object oriented, um, uh, program,
  • 5:45 - 5:47
    uh, methods call each other, they use a stack.
  • 5:47 - 5:49
    So every process contains,
    uh, a stack.
  • 5:49 - 5:52
    Uh, more specifically,
    um, a proce-
  • 5:52 - 5:54
    a process might contain
    multiple threads.
  • 5:54 - 5:56
    Each thread will contain
    its own stack.
  • 5:56 - 5:57
    But, let's just say
  • 5:57 - 5:59
    there is one thread
    in this process.
  • 5:59 - 6:01
    Uh, so, a process
    contains one stack,
  • 6:01 - 6:03
    and this stack is used
    by these functions or methods,
  • 6:03 - 6:07
    to pass arguments and return, uh, the result values.
  • 6:07 - 6:09
    So, for instance,
    when main calls f1,
  • 6:09 - 6:13
    main will push the arguments, uh, to f1, on top of the stack.
  • 6:13 - 6:15
    When f1 starts executing
  • 6:15 - 6:16
    it will pop, or remove,
  • 6:16 - 6:18
    the elements from the top
    of the stack
  • 6:18 - 6:20
    and use it to, uh, execute.
  • 6:20 - 6:24
    Uh, similarly, uh,
    when f1 calls f2,
  • 6:24 - 6:28
    um, f1 will push the arguments
    on top of the stack, for f2,
  • 6:28 - 6:31
    and then f2 will, um, uh,
    pop them, execute,
  • 6:31 - 6:34
    and then push the result values on top of the stack.
  • 6:34 - 6:36
    The result values
    then popped by f1.
  • 6:36 - 6:39
    This is the way in which f1
    gets back the result,
  • 6:39 - 6:43
    um, the final int return value from f2, to itself.
  • 6:43 - 6:47
    And finally when f-f1 needs
    to return a resolved value to,
  • 6:47 - 6:49
    uh, main, it pushes it
    on top of the stack
  • 6:49 - 6:51
    when the execution
    returns to main,
  • 6:51 - 6:53
    uh, main, uh, pops it
  • 6:53 - 6:54
    or removes it from
    the top of the stack
  • 6:54 - 6:58
    and main has
    the final return value from f1.
  • 6:58 - 6:59
    'Kay, so, the stack
  • 6:59 - 7:01
    is an important part
    of the process state as well,
  • 7:01 - 7:03
    because it tells you where
    in the program execution
  • 7:03 - 7:05
    you are, with respect
    to functions calling each other.
  • 7:07 - 7:08
    Finally, uh, y'know, uh,
  • 7:08 - 7:10
    functions have
    local variable, like x.
  • 7:10 - 7:12
    There might also be
    global variables, um,
  • 7:12 - 7:14
    uh, and of course in object oriented programs,
  • 7:14 - 7:15
    you have, uh, objects,
  • 7:15 - 7:17
    which store a lot
    of fields in them.
  • 7:17 - 7:19
    A lot of these, uh,
    pieces of data,
  • 7:19 - 7:21
    are stored in,
    what is known as a heap.
  • 7:21 - 7:23
    Okay, so, uh, a heap
    is essentially a lot of data,
  • 7:23 - 7:26
    uh, that was created
    by functions or methods,
  • 7:26 - 7:29
    uh, or, uh, um, by objects, um.
  • 7:29 - 7:33
    And it holds all of the data
    and, y'know, when an object,
  • 7:33 - 7:35
    when a function's executing,
  • 7:35 - 7:36
    uh, say f1 is executing,
  • 7:36 - 7:39
    uh, the object x might be created inside the heap,
  • 7:39 - 7:40
    when f1 is done executing.
  • 7:40 - 7:44
    X, uh, the object of x
    will be removed from the heap.
  • 7:44 - 7:45
    Similarly,
    there're also registers,
  • 7:45 - 7:47
    and I'll talk more
    about registers
  • 7:47 - 7:48
    when we discuss
    computer architecture,
  • 7:48 - 7:50
    but registers hold some
    of the, uh, recent values
  • 7:50 - 7:53
    that have been accessed, uh,
    by the process,
  • 7:53 - 7:53
    p1, in this case.
  • 7:55 - 7:57
    Okay, uh, speaking
    of computer architecture.
  • 7:57 - 7:59
    Let's discuss
    a simplified version
  • 7:59 - 8:00
    of computer architecture.
  • 8:00 - 8:03
    Computer architectures today,
    uh, can be very complicated.
  • 8:03 - 8:05
    But, um, typically when we ta-
  • 8:05 - 8:07
    when we think of how
    a process executes,
  • 8:07 - 8:08
    in a computer architecture,
  • 8:08 - 8:10
    we can think
    of a simplified view.
  • 8:10 - 8:11
    So there is a CPU,
  • 8:11 - 8:13
    which executes
    the action instructions,
  • 8:13 - 8:15
    which are present
    in your, uh, code.
  • 8:15 - 8:16
    There're also a bunch
    of registers,
  • 8:16 - 8:18
    that are co-located,
    uh, with the CPU.
  • 8:18 - 8:20
    These are, uh,
    small pieces of memory,
  • 8:20 - 8:23
    that can be accessed
    very quickly by the CPU.
  • 8:23 - 8:25
    Typically, uh, there's only
    a small number of registers.
  • 8:25 - 8:28
    Typically, not more than
    a few tens of registers.
  • 8:28 - 8:29
    Uh, there's also a cache,
  • 8:29 - 8:31
    which is,
    a slightly larger memory
  • 8:31 - 8:33
    than the collection
    of registers.
  • 8:33 - 8:35
    And the larger
    a map piece of memory is,
  • 8:35 - 8:36
    uh, the slower
    it is to access it.
  • 8:36 - 8:39
    So accessing a cache
    is slower than registers,
  • 8:39 - 8:40
    uh, than accessing registers.
  • 8:40 - 8:43
    But accessing a cache
    is still pretty fast.
  • 8:43 - 8:46
    Uh, then beyond the cache
    there is the main memory,
  • 8:46 - 8:48
    or the Random Access Memory,
    or the RAM.
  • 8:48 - 8:50
    Uh, which is even larger
    than the cache,
  • 8:50 - 8:52
    uh, and the ca-
    the memory itself,
  • 8:52 - 8:53
    therefore, is slower
    than the cache,
  • 8:53 - 8:55
    but still, it's pretty fast.
  • 8:55 - 8:56
    And then finally,
    there's hard disk,
  • 8:56 - 8:59
    or if you would like,
    a solid stave-state drive,
  • 8:59 - 9:00
    a flash, uh, drive, or whatever,
  • 9:00 - 9:03
    which is, a lot more memory than, uh, the main memory,
  • 9:03 - 9:05
    uh, but of course,
    it's much slower.
  • 9:05 - 9:09
    So, as you go up from disk,
    to memory, to cache, registers,
  • 9:09 - 9:10
    the speed increases,
  • 9:10 - 9:11
    the total amount
    of, uh, storage space
  • 9:11 - 9:12
    that you have, decreases.
  • 9:15 - 9:16
    So, when you write a program,
  • 9:16 - 9:19
    such as, C++, or Java, or C,
    and you compile it,
  • 9:19 - 9:22
    it gets compiled to low level machine instructions.
  • 9:22 - 9:23
    These machine instructions,
  • 9:23 - 9:25
    uh, might be specific
    to the architecture,
  • 9:25 - 9:26
    the machine on which
    you are running,
  • 9:26 - 9:28
    or it might be a, um,
  • 9:28 - 9:31
    ah, virtual machine,
    like a JVM, kind of, um, code.
  • 9:31 - 9:33
    In any case, uh, these low level machine instructions
  • 9:33 - 9:36
    are the executable version
    of your, uh, program,
  • 9:36 - 9:39
    and this is stored
    in file system, um, uh,
  • 9:39 - 9:41
    in the file system on-
    on your disk.
  • 9:41 - 9:43
    When your program
    starts executing,
  • 9:43 - 9:44
    when it becomes a process,
  • 9:44 - 9:47
    uh, the CPU loads instructions in batches,
  • 9:47 - 9:49
    or, m-, in a simplifi-
    more simplified way,
  • 9:49 - 9:51
    it loads instructions
    one by one.
  • 9:51 - 9:53
    Uh, it loads them into memory,
  • 9:53 - 9:55
    and then into cache,
    and into registers.
  • 9:55 - 9:57
    Typically, the cache
    and the registers contain
  • 9:57 - 9:59
    the last few
    accessed instructions.
  • 9:59 - 10:02
    Um, so they are, uhm,
  • 10:02 - 10:03
    they follow what is known as,
  • 10:03 - 10:05
    the least recently
    used principle.
  • 10:05 - 10:08
    Now, as it executes y-
    each instruction, the CPU,
  • 10:08 - 10:10
    which is executing the process, loads the data,
  • 10:10 - 10:12
    that is necessary
    for the instruction,
  • 10:12 - 10:13
    into the memory
    and then if necessary
  • 10:13 - 10:15
    into the cache
    and the registers.
  • 10:15 - 10:18
    Um, and if there are
    any necessary, uh, changes
  • 10:18 - 10:20
    that happen
    to a variable like, x,
  • 10:20 - 10:23
    then, these are stored
    into a memory, um, um,
  • 10:23 - 10:25
    uh, first into cache
    and then into memory.
  • 10:27 - 10:29
    Once in a while, you may need
    to store something on disks,
  • 10:29 - 10:32
    so that you have, um,
    a permanent storage.
  • 10:32 - 10:33
    So in case,
    the process goes offline,
  • 10:33 - 10:36
    then you still have some data.
  • 10:36 - 10:37
    Say for instance,
    the program might open a file
  • 10:37 - 10:39
    and write something
    into the file.
  • 10:39 - 10:41
    So, in this case,
    uh, you may want to write those,
  • 10:41 - 10:43
    uh, updates to the file
    onto the disk.
  • 10:44 - 10:45
    Now, of course this is a very highly simplified picture.
  • 10:45 - 10:47
    Computer architectures
    can be far more,
  • 10:47 - 10:49
    uh, complex than this, today,
  • 10:49 - 10:52
    but for our practical purposes, in this course, and as far as,
  • 10:52 - 10:56
    uh, explaining how processes work, um, this will suffice.
  • 10:59 - 11:01
    So next, we move on
    to a few mathematical topics.
  • 11:01 - 11:03
    The first mathematical topic is, a Big O notation.
  • 11:03 - 11:04
    A Big O notation is,
  • 11:04 - 11:06
    one of the most basic ways
    of analyzing algorithms.
  • 11:06 - 11:08
    When I give you an algorithm,
  • 11:08 - 11:10
    and I say analyze
    the algorithm mathematically,
  • 11:10 - 11:12
    essentially, I expect you to,
    uh, come up with,
  • 11:12 - 11:14
    at least a Big O notation,
  • 11:14 - 11:17
    uh, and an analysis
    of that algorithm.
  • 11:17 - 11:18
    The-the Big O notation,
  • 11:18 - 11:21
    describes an upper bound
    in the behavior of an algorithm.
  • 11:21 - 11:23
    Um, as some variable is scaled
  • 11:23 - 11:26
    or increased in value
    all the way to infinity.
  • 11:26 - 11:29
    Typically, this variable
    is a size of the input.
  • 11:29 - 11:31
    Um, maybe the number
    of input elements,
  • 11:31 - 11:33
    um, you'll see-sa-you'll see
    a few examples of this.
  • 11:34 - 11:38
    So, essentially, this, uhh-oah,
    Big O analysis tells us,
  • 11:38 - 11:40
    how does the, uh,
    algorithm itself
  • 11:40 - 11:44
    scale as the size
    of the input is increased?
  • 11:44 - 11:46
    Um, this analyzes the run time,
  • 11:46 - 11:48
    or typically, another performance metric, as well.
  • 11:48 - 11:49
    Most of the time,
    we analyze run time,
  • 11:49 - 11:51
    sometimes, as you'll see
    in the course,
  • 11:51 - 11:53
    we'll analyze things like
    number of messages,
  • 11:53 - 11:56
    um, uh, even, uh, bandwidth, um,
  • 11:56 - 11:59
    uh, that is exchanged
    i-in the total network itself.
  • 11:59 - 12:01
    The important thing about
    Big O notation is that,
  • 12:01 - 12:03
    i-it captures
    worst case performance.
  • 12:03 - 12:05
    Okay, so this is not
    expected performance
  • 12:05 - 12:06
    or best case performance.
  • 12:06 - 12:08
    Big O is worst case performance.
  • 12:08 - 12:09
    Given this algorithm,
  • 12:09 - 12:12
    what is the worst that it can do in terms of, uh,
  • 12:12 - 12:13
    this performance metric
    that we're measuring?
  • 12:15 - 12:19
    So, essentially, when I say,
    an algorithm A is order of foo,
  • 12:19 - 12:19
    this means that,
  • 12:19 - 12:24
    Algorithm A takes < c foo
    time to complete,
  • 12:24 - 12:25
    assuming time is the metric
    we are measuring,
  • 12:25 - 12:28
    for some constant c,
    a fixed constant c,
  • 12:28 - 12:31
    uh, beyond some input size N.
  • 12:31 - 12:32
    Okay? Typically, this foo
  • 12:32 - 12:34
    that is, uh, present
    in the definition is s-,
  • 12:34 - 12:36
    uh, uh, some function
    of input size N.
  • 12:36 - 12:39
    For instance, I could say that
    an algorithm is order N,
  • 12:39 - 12:42
    which means that algorithm A
    takes less than c times N
  • 12:42 - 12:45
    time to complete
    for some constant c,
  • 12:45 - 12:46
    beyond some input size N.
  • 12:46 - 12:48
    Similarly the algorithm
    might be order N^2.
  • 12:48 - 12:51
    Which means, that, uh,
    it is quadratic in time,
  • 12:51 - 12:53
    and it takes time
    less than c times N squared
  • 12:53 - 12:56
    for some constant c.
  • 12:56 - 12:59
    Once again, when we say order
    N^2 or order N,
  • 12:59 - 13:01
    notice that we do not include the constant c,
  • 13:01 - 13:02
    in the definition itself.
  • 13:02 - 13:04
    This is because,
    the constant is irrelevant,
  • 13:04 - 13:05
    as long as there
    is a fixed constant,
  • 13:05 - 13:07
    some fixed constant.
  • 13:07 - 13:09
    That is good enough for us
    as far as Big O notation
  • 13:09 - 13:11
    is, uh, concerned.
  • 13:11 - 13:13
    Okay, so we do not state
    the constants in Big O notation.
  • 13:14 - 13:15
    So let's see
    a couple of examples.
  • 13:15 - 13:18
    Um, so first,
    I give you an unsorted list
  • 13:18 - 13:20
    o-of, say, integers.
  • 13:20 - 13:21
    And I ask you to search
    for a specific element
  • 13:21 - 13:23
    in the list.
  • 13:23 - 13:24
    This essentially means,
    that you have to iterate through
  • 13:24 - 13:26
    the list, one item at a time.
  • 13:26 - 13:28
    And search for the element
    by trying to match it
  • 13:28 - 13:31
    with each element quality
    present, in the list.
  • 13:31 - 13:32
    What is the worst
    case performance?
  • 13:32 - 13:34
    That's what we need,
    for Big O notation, right?
  • 13:34 - 13:35
    So, the worst case performance
    happens when,
  • 13:35 - 13:38
    either element is not there,
    at all, in the list,
  • 13:38 - 13:39
    so, you return a false.
  • 13:39 - 13:43
    Uh, or the element is the very
    last one, in the list.
  • 13:43 - 13:44
    The very last one,
    that you match against.
  • 13:45 - 13:46
    Therefore, the
    worst case performance
  • 13:46 - 13:47
    involves N operations,
  • 13:47 - 13:52
    and the number of operations involved is < c* N, where c=2,
  • 13:52 - 13:54
    because the number
    of operations is N,
  • 13:54 - 13:55
    where N is the size of the list.
  • 13:56 - 13:58
    Okay, so, the time as well as,
    the number of operations,
  • 13:58 - 14:01
    uh, assuming each operation
    takes one unit of time.
  • 14:01 - 14:06
    Both the time taken for this,
    uh, um, uh, for this algorithm,
  • 14:06 - 14:06
    which iterates through the list.
  • 14:06 - 14:10
    As a list number
    of operations are both order N.
  • 14:10 - 14:11
    That's why we see
    order N over here.
  • 14:13 - 14:14
    Let's take
    a different, uh, example
  • 14:14 - 14:17
    to see how
    Big O notation works.
  • 14:17 - 14:19
    This leads with insertion
    sorting of an unsorted list.
  • 14:19 - 14:22
    So suppose I give you a list
    of elements, uh, say integers,
  • 14:22 - 14:25
    and this is unsorted
    and I ask you to sort them,
  • 14:25 - 14:29
    say in increasing order of,
    uh, the, uh, elements.
  • 14:29 - 14:31
    The insertion sorter algorithm
    works as follows;
  • 14:31 - 14:33
    first, you create a new list, that is empty.
  • 14:33 - 14:35
    Then, you iterate
    through the elements
  • 14:35 - 14:37
    in the unsorted original list,
  • 14:37 - 14:38
    you remove
    one element at a time,
  • 14:38 - 14:40
    and you insert the element,
  • 14:40 - 14:42
    in the new list
    at the appropriate position.
  • 14:42 - 14:45
    Essentially, you sort through
    the new list, uh, linearly,
  • 14:45 - 14:47
    uh, searching
    for the right position
  • 14:47 - 14:49
    where this element, should be.
  • 14:49 - 14:50
    So, if you do this,
  • 14:50 - 14:52
    the first element, of course, takes one operation to insert.
  • 14:52 - 14:54
    That's one insert operation.
  • 14:54 - 14:56
    The second element,
    in the worst case,
  • 14:56 - 14:57
    takes two operations to insert.
  • 14:57 - 14:59
    One operation
    for the comparison,
  • 14:59 - 15:00
    with the one element that's already present,
  • 15:00 - 15:02
    in the new sorted list
  • 15:02 - 15:03
    and one more operation
    to insert.
  • 15:03 - 15:05
    Imagine the case,
    the worst case,
  • 15:05 - 15:07
    where, this second element,
  • 15:07 - 15:09
    is inserted right
    at the very end, of the list.
  • 15:10 - 15:12
    Similarly, the third element,
    will take, uh,
  • 15:12 - 15:13
    three operations to insert,
  • 15:13 - 15:14
    where the first two elements,
  • 15:14 - 15:16
    compared with the two
    already existing elements,
  • 15:16 - 15:18
    the third, uh, uh, operation,
  • 15:18 - 15:22
    uh, inserts it at the very end of, uh, the, ah,
  • 15:22 - 15:23
    uh, of the list.
  • 15:23 - 15:24
    If, you go on like this
  • 15:24 - 15:26
    and the i-th element
    takes i operations to insert,
  • 15:26 - 15:29
    and you can calculate that
    the total time required
  • 15:29 - 15:33
    to insert all the, m, elements is 1+2+3, so on until N.
  • 15:33 - 15:37
    And this is a well-known sum
    which comes to N(N+1)/2,
  • 15:37 - 15:39
    which is, uh, <1*N^2.
  • 15:39 - 15:42
    So, with a value
    of C equals one, uh, this, uh,
  • 15:42 - 15:44
    insertion sorting example,
  • 15:44 - 15:48
    is an algorithm that takes
    order N^2 in time,
  • 15:48 - 15:50
    and also order N^2
    in number of operations.
  • 15:55 - 15:57
    Next, we look at a little bit
    of basic probability,
  • 15:57 - 15:58
    uh, before probability,
  • 15:58 - 16:00
    we need to discuss,
    few definitions.
  • 16:00 - 16:02
    Uh, the first definition
    is a set.
  • 16:02 - 16:04
    A set is, essentially,
    a collection of things.
  • 16:04 - 16:07
    So for instance, a set S
    might be the set of all humans,
  • 16:07 - 16:09
    who live in this world,
    at this current moment.
  • 16:09 - 16:12
    A subset, is another set,
    which is a collection of things,
  • 16:12 - 16:14
    that is a part
    of the larger set.
  • 16:14 - 16:17
    So, I might design a-, uh,
    da, uh, describe a set S2,
  • 16:17 - 16:18
    which says,
  • 16:18 - 16:21
    a set of all humans who live, currently, in Europe, today.
  • 16:21 - 16:23
    S2 is a subset of S,
  • 16:23 - 16:25
    because every element
    that is present in S2
  • 16:25 - 16:26
    is also present in S,
  • 16:26 - 16:28
    but the reverse
    is not necessarily true.
  • 16:31 - 16:34
    Okay, so now, um, probability,
  • 16:34 - 16:37
    any-any event, uh,
    has a probability of happening.
  • 16:37 - 16:40
    Okay, so, umm,
    let me give you an example.
  • 16:40 - 16:42
    If you wake up
    at a random hour of the day,
  • 16:42 - 16:45
    um, so you just wake up
    at some random hour of the day,
  • 16:45 - 16:46
    say you're jet lagged
    or something.
  • 16:46 - 16:49
    Uh, and, uh, I ask you,
    what is the probability,
  • 16:49 - 16:52
    that the event at that time
    is between 10 a.m. and 11 a.m.?
  • 16:52 - 16:53
    Let's try to calculate this.
  • 16:54 - 16:56
    Well, there are
    24 hours in a day,
  • 16:56 - 16:59
    so you have a set
    that consists of 24 elements,
  • 16:59 - 17:02
    one for each hour, 12 a.m.,
    1 a.m., 2 a.m.,
  • 17:02 - 17:05
    all the way til,
    10 a.m., 11 a.m., 11 p.m.
  • 17:05 - 17:08
    'Kay, so when I say
    an element like, uh, 1 a.m.
  • 17:08 - 17:11
    I mean, the hour
    between 1 a.m. and 1:59 am.
  • 17:11 - 17:14
    Similarly, 10 a.m. means,
    10 a.m. and 10:59 a.m.
  • 17:15 - 17:18
    Out of the set of 24 elements,
    you pick one, at random.
  • 17:18 - 17:20
    And the probability that
    you're going to pick 10 a.m.,
  • 17:20 - 17:22
    is essentially, 1 divided by 24,
  • 17:22 - 17:24
    because you're picking
    one element at random
  • 17:24 - 17:27
    and there are 24 elements,
    uh, in the set,
  • 17:27 - 17:29
    and the probability
    that you pick,
  • 17:29 - 17:33
    um, that one special element,
    10 a.m., is 1 over 24,
  • 17:33 - 17:35
    because you-you wanna pick,
    you wanna be lucky,
  • 17:35 - 17:37
    o-of that, uh,
    to pick that, uh, 10.
  • 17:37 - 17:39
    Okay, so,
    the probability that you,
  • 17:39 - 17:40
    if you wake up
    at a random hour of the day,
  • 17:40 - 17:42
    the time is between
    10 a.m. and 11 a.m.,
  • 17:42 - 17:44
    the-that probability
    is 1 over 24.
  • 17:47 - 17:49
    Now, uh, there might be
    multiple events
  • 17:49 - 17:51
    that you might need to calculate
    the probability of,
  • 17:51 - 17:53
    uh, conjunctions or disjunctions of these events.
  • 17:53 - 17:54
    I'll describe
    what these are, soon.
  • 17:54 - 17:56
    So say, E1 is one event
    and E2 is another event,
  • 17:56 - 17:59
    and E1 and E-E2 are
    independent of each other.
  • 17:59 - 18:00
    This means that,
  • 18:00 - 18:02
    E1 does not influence E2,
    E2 does not influence E1.
  • 18:02 - 18:05
    Then the probability
    that E1 and E2 both happen,
  • 18:05 - 18:06
    is essentially,
  • 18:06 - 18:08
    the multiplication
    of these probabilities.
  • 18:08 - 18:10
    So you take
    the probability of E1,
  • 18:10 - 18:11
    multiply it by
    the probability of E2,
  • 18:11 - 18:12
    and that gives you,
  • 18:12 - 18:15
    the probability that
    both E1 and E2 are true.
  • 18:15 - 18:16
    Let's discuss
    an example of this.
  • 18:16 - 18:18
    Suppose you have three shirts.
  • 18:18 - 18:20
    They're colored
    blue, green, and red.
  • 18:20 - 18:23
    And also you wake up at a random
    hour and blindly pick a shirt,
  • 18:23 - 18:26
    you put your, uh, hand
    into your, uh, closet,
  • 18:26 - 18:28
    and you blindly
    pick out a shirt.
  • 18:28 - 18:29
    What is the probability that,
  • 18:29 - 18:31
    he woke up between
    10 a.m. and 11 a.m.
  • 18:31 - 18:34
    and, that he picked
    a green shirt to wear?
  • 18:34 - 18:36
    Well, the first probability
    of the first event,
  • 18:36 - 18:37
    that he woke up
    between 10 and 11,
  • 18:37 - 18:39
    is essential, 1 over 24,
  • 18:39 - 18:41
    like we calculated
    on the previous slide.
  • 18:41 - 18:43
    The probability that you pick
    the green shirt, is essentially,
  • 18:43 - 18:45
    one out of three, because there
    are three colors of shirts,
  • 18:45 - 18:47
    uh, you have three shirts
  • 18:47 - 18:49
    and, uh, you want
    to pick the green one,
  • 18:49 - 18:50
    you want to be lucky,
    to pick the green one,
  • 18:50 - 18:51
    so that's one over three.
  • 18:51 - 18:53
    And so, the probability that
    both these events are true,
  • 18:53 - 18:55
    that you woke up
    between 10 and 11,
  • 18:55 - 18:57
    and that you wore
    the green shirt
  • 18:57 - 18:58
    is the multiplication
    of the probabilities
  • 18:58 - 19:00
    of those events.
  • 19:00 - 19:04
    So it's (1/24)*(1/3)=1/72.
  • 19:05 - 19:06
    One of the things,
  • 19:06 - 19:07
    that you have
    to be careful about here,
  • 19:07 - 19:10
    is that, uh, if E1 and E2
    are not independent,
  • 19:10 - 19:12
    meaning that they influence
    each other in some way,
  • 19:12 - 19:15
    uh, then, you cannot multiply, uh, the, uh, probabilities
  • 19:15 - 19:16
    with, uh, each other.
  • 19:16 - 19:20
    Okay, so, for instance,
    um, if, uh,
  • 19:20 - 19:22
    the shirts that you have
    in your closet,
  • 19:22 - 19:25
    uh, change from one hour
    to another, because, uh,
  • 19:25 - 19:26
    um, say, uh,
  • 19:26 - 19:28
    someone in your house
    changes them around,
  • 19:28 - 19:31
    then you can't necessarily multiply these probabilities,
  • 19:31 - 19:31
    as they are here.
  • 19:33 - 19:34
    A different thing
    that we need to do
  • 19:34 - 19:37
    with two event probabilities is,
    uh, to OR them.
  • 19:37 - 19:39
    So, if, I give you two events,
    E1 and E2
  • 19:39 - 19:41
    and I ask you
    the probability that,
  • 19:41 - 19:43
    uh, of either E1 or E2 happening
  • 19:43 - 19:46
    then, you can say that
    Prob(E1 OR E2)=
  • 19:46 - 19:51
    Prob(E1)+Prob(E2)-
    Prob(E1 AND E2).
  • 19:51 - 19:53
    Okay, so, this is the intersection probability here.
  • 19:53 - 19:56
    If, you do not know
    probability of E1 and E2,
  • 19:56 - 19:57
    this last term over here,
  • 19:57 - 20:01
    than, you can write the inequality Prob(E1 OR E2)<=
  • 20:01 - 20:03
    the sum of the constituent probabilities, okay?
  • 20:05 - 20:07
    Sometimes we use these
    inequalities to upper bound,
  • 20:07 - 20:11
    uh, the, uh, probabilities
    of the, um, uh, disjunctions,
  • 20:11 - 20:12
    as we see here.
  • 20:14 - 20:15
    Okay, let's disces-discuss
    a couple of-of,
  • 20:15 - 20:16
    a few miscellaneous topics.
  • 20:16 - 20:18
    The first miscellaneous topic
    is, a Domain Name System,
  • 20:18 - 20:19
    or known as DNS.
  • 20:19 - 20:20
    This is a collection of servers,
  • 20:20 - 20:22
    that are spread throughout
    the world and, uh,
  • 20:22 - 20:23
    the DNS is very critical
  • 20:23 - 20:26
    to the operation
    of the, uh, web.
  • 20:26 - 20:27
    Uh, typically the input
  • 20:27 - 20:30
    to the DU-to the DNS system
    is a URL, say coursera.org.
  • 20:30 - 20:32
    Uh, the URL is a name,
  • 20:32 - 20:33
    it's a human readable string,
  • 20:33 - 20:35
    that uniquely identifies
    the object.
  • 20:35 - 20:36
    Uh, typically,
    when you go to your browser,
  • 20:36 - 20:40
    whether it's Safari, Chrome, Internet Explorer, Netscape,
  • 20:40 - 20:42
    Firefox, or whatever
    your favorite browser is.
  • 20:42 - 20:45
    Uh, you might enter a URL
    like coursera.org,
  • 20:45 - 20:46
    the moment you hit Enter
    on your browser,
  • 20:46 - 20:49
    your browser goes off
    and contacts a DNS, the DNS,
  • 20:49 - 20:52
    the DNS system, and, uhm, uh, gives the DNS system
  • 20:52 - 20:56
    the name of this URL,
    which is coursera.org.
  • 20:56 - 20:57
    What does the DNS
    give back to your browser?
  • 20:57 - 20:59
    It gives back the IP address
    of a web server,
  • 20:59 - 21:02
    that hosts that content,
    so that your machine,
  • 21:02 - 21:04
    your browser can tho-
    then go and send a request,
  • 21:04 - 21:06
    to that IP address,
  • 21:06 - 21:09
    and fetch the actual content
    of that web page.
  • 21:09 - 21:10
    So, the IP address is an ID,
  • 21:10 - 21:12
    it's a unique string that points to that particular object.
  • 21:12 - 21:15
    For instance,
    the coursera.org, uh, web page.
  • 21:15 - 21:19
    Uh, and the, um, the ID itself
    may not be human readable.
  • 21:19 - 21:21
    So, essentially, a DNS
    is a system that translates
  • 21:21 - 21:23
    between a human readable name,
  • 21:23 - 21:26
    such as, a URL,
    to, uh, to, uh, unique ID,
  • 21:26 - 21:28
    um, which may
    or may not be human readable,
  • 21:28 - 21:29
    like the IP address.
  • 21:31 - 21:32
    Uh, in this case, IP address
    may refer to either,
  • 21:32 - 21:34
    the actual web server
    that is storing the content,
  • 21:34 - 21:36
    or maybe an indirection server
  • 21:36 - 21:37
    such as, a content distribution network server,
  • 21:37 - 21:40
    or, uh, such as,
    an Akamai server that is,
  • 21:40 - 21:43
    uh, hosting or, uh, caching
    the content on your behalf.
  • 21:45 - 21:47
    Uh, graphs,
  • 21:47 - 21:49
    um, so when we say graphs,
    in computer science,
  • 21:49 - 21:52
    we don't necessarily mean plots,
    which have x and y axes.
  • 21:52 - 21:54
    Uh, a graph,
    is essentially, a network.
  • 21:54 - 21:57
    So here I am showing you a graph
    of some cities,
  • 21:57 - 22:00
    um, Amsterdam, Boston,
    Chicago, Delhi, and Edmonton,
  • 22:00 - 22:04
    and the travel times,
    uh, between those cities by air,
  • 22:04 - 22:06
    um, rounded up
    to the nearest hour.
  • 22:06 - 22:09
    Okay, so, uh, traveling
    from Amsterdam to Boston
  • 22:09 - 22:10
    takes about six hours.
  • 22:10 - 22:11
    Traveli-traveling
    from Chicago to Delhi
  • 22:11 - 22:13
    takes about 14 hours.
  • 22:13 - 22:14
    Say these are the flights
    that are available
  • 22:14 - 22:16
    on some particular airline.
  • 22:16 - 22:18
    Right?
  • 22:18 - 22:19
    So, you see both cities here,
    as well as,
  • 22:19 - 22:21
    uh, connections between,
    uh, pairs of cities,
  • 22:21 - 22:26
    uh, and also, um, some values along those connections,
  • 22:26 - 22:28
    which are, the number of hours it takes to transit
  • 22:28 - 22:28
    between those cities.
  • 22:30 - 22:31
    Uh, these all have names,
    in the terms,
  • 22:31 - 22:32
    in the world of graphs.
  • 22:32 - 22:35
    So, each city,
    would be a node or a vertex.
  • 22:35 - 22:38
    Uh, each connection
    between a pair of nodes,
  • 22:38 - 22:40
    would be called an edge,
  • 22:40 - 22:44
    and the value along an edge
    is called the edge weight.
  • 22:44 - 22:47
    Also, when I say
    that A is adjacent to B,
  • 22:47 - 22:52
    this means that A has an edge that connects it to B, directly.
  • 22:52 - 22:53
    Typically, an edge
    only goes between,
  • 22:53 - 22:56
    uh, uh two nodes
    or two vertices.
  • 22:56 - 22:58
    An edge does not cross
    three, uh, nodes.
  • 22:58 - 23:03
    So here, for instance, I have,
    um, uh, 1, 2, 3, 4, 5 vertices,
  • 23:03 - 23:04
    and how many edges do I have?
  • 23:04 - 23:09
    I have an A-E edge, an A-B edge,
    a B-E edge, a B-C edge
  • 23:09 - 23:10
    and a C-D edge,
  • 23:10 - 23:12
    so, I also have, uh, five,
    uh, different edges,
  • 23:12 - 23:15
    each with its own,
    uh, edge weight.
  • 23:18 - 23:19
    So, in this, uh, lecture,
    we have covered,
  • 23:19 - 23:22
    the basic data structure,
    such as, uh, queue and a stack,
  • 23:22 - 23:24
    we have seen that processes
    are programs in action,
  • 23:24 - 23:27
    and that they consist
    of multiple different pieces,
  • 23:27 - 23:29
    uh, processes of course are under computer architecture,
  • 23:29 - 23:30
    and it's important
    for you to know,
  • 23:30 - 23:33
    at least, a simplified version of the computer architecture,
  • 23:33 - 23:35
    so that you know what's,
    ah, operating where,
  • 23:35 - 23:37
    uh, when you run a process.
  • 23:37 - 23:38
    We've seen some
    mathematical topics,
  • 23:38 - 23:39
    such as, Big O notation
  • 23:39 - 23:40
    which, analyzes the worst
    case performance
  • 23:40 - 23:42
    of any given algorithm,
  • 23:42 - 23:44
    and then some basic probability.
  • 23:44 - 23:46
    And finally, we have seen
    a few miscellaneous topics.
  • 23:46 - 23:48
    I hope you can come back-
    keep coming back to this,
  • 23:48 - 23:49
    as a reference,
    whenever you need it,
  • 23:49 - 23:51
    uh, throughout,
    uh, the, uh, course.
Title:
An Orientation to Cloud Computing (00:24:02)
Description:

From the Cloud Computing Concepts Course (University of Ilinois) on Coursera

more » « less
Video Language:
English

English subtitles

Revisions