Tuesday, December 31, 2019

Food Apps / Website Promo / Invite Link




Image result for grubhub


1. Seamless / GrubHub


12 dollars off 15 dollars food delivery
*Only works for delivery, does not work with pick up

Both seamless and grubhub is the same company but with two name. Similar to Kroger and Ralphs

Hungry? Try Seamless! Use my link on your first order and we’ll both get $12 off. https://www.seamless.com/referral/85c90182-94e7-e311-90f4-5cf3fc94f584





Image result for ubereats

2. Uber Eats 

Get $15 off your first Uber Eats order of $20 or more.
Terms apply.
Use my code at checkout: eats-anitav879ue 
http://ubr.to/EatsGiveGet





Image result for paris baguette

3. Paris Baguette

Free Coffee when you download the app and sign up
Use my code Annie1961 when you sign up for the Paris Baguette app! Use this link to download: https://engagement.punchh.com/b/parisbaguette




4. Ritual App
Free $10
This app is for ordering food and then you can pick up the food without having to wait in line.
Sign up using this link to get $10 free:
Use Ritual to order pickup and get your $10 credit off:https://invite.ritual.co/DANIEL50803




Monday, December 30, 2019

Legit Side Gigs Apps


These apps I tried and I get paid for real. They usualy ask you to go take pictures of buildings or products and then they paid you buy Paypal or Direct deposit.

1. Field Agent App
I've been enjoying making extra cash and trying new products in the Field Agent App and I thought you would too!
https://fieldagent.page.link/1uXbJiitPs2L1tfo9
Pay by direct deposit



2. Observa
Pay using Paypal



Wednesday, December 25, 2019

DO NOT Use credit cards at online Betting / Gambling website


Why you should not Use credit cards at online Betting / Gambling websites.

Using your credit cards at Online Sportsbook website is a bad idea.
Because it will be count as cash advance, and you will have to pay so much fees.
And many online sports betting and gambling website doesn't even warn you about these fees when using your credit cards.

These are sports betting website that you should not use credit card on, because the charges will be categorized as cash advance.

Fanduel

FanDuel SportsBook


DraftKing



Monday, December 23, 2019

เพลง Noel - Chris Tomlin แปลเป็นภาษาไทย

เพลงคริสตมาส Noel - Chris Tomlin 

แปลเนื้อร้องเป็นภาษาไทย

🙏 🙏🙏

รักมาบังเกิด รักพระเจ้า ดวงดาวและทูตสวรรค์ส่งสัญญาณ
Love incarnate, love divine Star and angels gave the sign

คุกเข่าเฝ้าก้มกราบ ทารกน้อย พระผู้ช่วยของมวลมนุษย์
Bow to babe on bended knee The Savior of humanity

ทารกน้อยเกิดมาเพื่อเรา จะทรงครอบครองชั่วนิรันดร์
Unto us a Child is born He shall reign forevermore

โนเอล โนเอล
Noel, Noel

นี่ ! สิ่งที่พระเจ้าทรงทำไป
Come and see what God has done

โนเอล โนเอล
Noel, Noel

เรื่องราวความรักอันอัศจรรย์ ! แสงส่องโลกนี้ ที่ทรงมอบให้เรา
The story of amazing love! The light of the world, given for us

โนเอล
Noel

บุตรพระเจ้าและบุตรมนุษย์ ก่อนที่โลกนี้ จะมีมา
Son of God and Son of man There before the world began

เกิดเพื่อทุกข์ทน เพื่อช่วยคน เกิดเพื่อช่วยเรา พ้นจากความตาย
Born to suffer, born to save Born to raise us from the grave

องค์อมตะพระคริสต์ผู้เป็นเจ้า จะทรงครอบครองชั่วนิรันดร์
Christ the everlasting Lord He shall reign forevermore

โนเอล โนเอล

Noel, Noel

นี่ ! สิ่งที่พระเจ้าทรงทำไป
Come and see what God has done

โนเอล โนเอล
Noel, Noel

เรื่องราวความรักอันอัศจรรย์ แสงส่องโลกนี้ ที่ทรงมอบให้เรา
The story of amazing love! The light of the world, given for us

โนเอล โนเอล โนเอล
Noel
Noel, Noel

นี่ ! สิ่งที่พระเจ้าทรงทำไป
Come and see what God has done

โนเอล โนเอล
Noel, Noel

เรื่องราวความรักอันอัศจรรย์! แสงส่องโลกนี้ ที่ทรงมอบให้เรา
The story of amazing love! The light of the world, given for us

Noel, Noel
🌌🌌🌌




แปลโดย : Nai Dorngh 12/24/2019

Free bubble tea at Kung Fu Tea when you download thier app

Free bubble tea 

at Kung Fu Tea 

when you download thier app,

Image result for kung fu tea
Once you download the app through my special referral link, you'll get $4 to use towards a Drink at KFT
Claim your credit now: https://www.thelevelup.com/c/EM-4C3KAYGR7B

Download Kung Fu Tea App HERE




Sunday, December 22, 2019

Operating System: Process and Concurrent Execution - Interview Questions and Solutions

Operating System: Process and Concurrent Execution; 

Questions and Solutions




The concepts of a process and concurrent execution; These concepts are at the very heart of modern operating systems. A process is a program in execution and is the unit of work in a modern time-sharing system. Such a system consists of a collection of processes: Operating-system processes executing system code and user processes executing user code. All these processes can potentially execute concurrently, with the CPU (or CPUs) multiplexed among them. By switching the CPU between processes, the operating system can make the computer more productive. We also introduce the notion of a thread (lightweight process) and interprocess communication (IPC).

Exercises
1. Describe the differences among short-term, medium-term, and long-term scheduling.
Answer:
a. Short-term (CPU scheduler)—selects from jobs in memory those jobs that are ready to execute and allocates the CPU to them.
b. Medium-term—used especially with time-sharing systems as an intermediate scheduling level. A swapping scheme is implemented to remove partially run programs from memory and reinstate them later to continue where they left off.
c. Long-term (job scheduler)—determines which jobs are brought into memory for processing.
The primary difference is in the frequency of their execution. The short-term must select a new process quite often. Long-term is used much less often since it handles placing jobs in the system and may wait a while for a job to finish before it admits another one.

2. Describe the actions taken by a kernel to context-switch between processes.
Answer:
In general, the operating system must save the state of the currently running process and restore the state of the process scheduled to be run next. Saving the state of a process typically includes the values of all the CPU registers in addition to memory allocation. Context switches must also perform many architecture-specific operations, including flushing data and instruction caches.

3. Explain the role of the init process on UNIX and Linux systems in regards to process termination.
Answer:
When a process is terminated, it briefly moves to the zombie state and remains in that state until the parent invokes a call to wait(). When this occurs, the process id as well as entry in the process table are both released. However, if a parent does not invoke wait(), the child process remains a zombie as long as the parent remains alive. Once the parent process terminates, the init process becomes the new parent of the zombie. Periodically, the init process calls wait() which ultimately releases the pid and entry in the process table of the zombie process.

4 Give an example of a situation in which ordinary pipes are more suitable than named pipes and an example of a situation in which named pipes are more suitable than ordinary pipes.
Answer:
Simple communication works well with ordinary pipes. For example, assume we have a process that counts characters in a file. An ordinary pipe can be used where the producer writes the file to the pipe and the consumer reads the files and counts the number of characters in the file. Next, for an example where named pipes are more suitable, consider the situation where several processes may write messages to a log. When processes wish to write a message to the log, they write it to the named pipe. A server reads the messages from the named pipe and writes them to the log file.

5. Consider the RPC mechanism. Describe the undesirable consequences that could arise from not enforcing either the “at most once” or “exactly once” semantic. Describe possible uses for a mechanism that has neither of these guarantees.
Answer:
If an RPC mechanism cannot support either the “at most once” or “at least once” semantics, then the RPC server cannot guarantee that a remote procedure will not be invoked multiple occurrences. Consider if a remote procedure were withdrawing money from a bank account on a system that did not support these semantics. It is possible that a single invocation of the remote procedure might lead to multiple withdrawals on the server.
For a system to support either of these semantics generally requires the server maintain some form of client state such as the timestamp described in the text.
If a system were unable to support either of these semantics, then such a system could only safely provide remote procedures that do not alter data or provide time-sensitive results. Using our bank account as an example, we certainly require “at most once” or “at least once” semantics for performing a withdrawal (or deposit!). However, an inquiry into an account balance or other account information such as name, address, etc. does not require these semantics.

6. Using the program shown in Figure 3.35, explain what the output will be at lines X and Y.
Answer:
Because the child is a copy of the parent, any changes the child makes will occur in its copy of the data and won’t be reflected in the parent. As a result, the values output by the child at line X are 0, -1, -4, -9, -16. The values output by the parent at line Y are 0, 1, 2, 3, 4

7. What are the benefits and the disadvantages of each of the following? Consider both the system level and the programmer level.
a. Synchronous and asynchronous communication
b. Automatic and explicit buffering
c. Send by copy and send by reference
d. Fixed-sized and variable-sized messages
Answer:
a. Synchronous and asynchronous communication—A benefit of synchronous communication is that it allows a rendezvous between the sender and receiver. A disadvantage of a blocking send is that a rendezvous may not be required and the message could be delivered asynchronously. As a result, message-passing systems often provide both forms of synchronization.
b. Automatic and explicit buffering—Automatic buffering provides a queue with indefinite length, thus ensuring the sender will never have to block while waiting to copy a message. There are no specifications on how automatic buffering will be provided; one scheme may reserve sufficiently large memory where much of the memory is wasted. Explicit buffering specifies how large the buffer is. In this situation, the sender may be blocked while waiting for available space in the queue. However, it is less likely that memory will be wasted with explicit buffering.
c. Send by copy and send by reference—Send by copy does not allow the receiver to alter the state of the parameter; send by reference does allow it. A benefit of send by reference is that it allows the programmer to write a distributed version of a centralized application. Java’s RMI provides both; however, passing a parameter by reference requires declaring the parameter as a remote object as well.
d. Fixed-sized and variable-sized messages—The implications of this are mostly related to buffering issues; with fixed-size messages, a buffer with a specific size can hold a known number of messages. The number of variable-sized messages that can be held by such a buffer is unknown. Consider how Windows 2000 handles this situation: with fixed-sized messages (anything < 256 bytes), the messages are copied from the address space of the sender to the address space of the receiving process. Larger messages (i.e. variable-sized messages) use shared memory to pass the message.

Operating Systems: Virtual Memory - Exam Questions and Solutions


Operating Systems: Virtual Memory

Example Test Questions and Solutions

    Q1. When do page faults occur? Describe the actions taken by the OS when a page fault occurs.

    Sol: A page fault occurs whenever a process tries  to access a  page which is marked as invalid in the page table entry for that page. A page fault generates an interrupt which invokes the operating system code in privileged mode. The OS then examines some internal table (usually kept with the process control block for this process) to determine if the page is on disk. If the page is on disk (i.e. it really is a valid memory reference) the operating system then allocates a free frame, starts the disk I/O to read the desired page into the newly allocated frame, and starts the next process. When the disk I/O is finished, the internal table kept with the process and page tables are updated to indicate that the page is now in memory. The instruction that was interrupted by the illegal address trap is restarted. The process can now access the page as though it had always been in memory.

Q2.   Suppose we have a system with 32 bit virtual addresses, in which the least-significant bits are used to indicate a 10-bit    page offset.

   a) what is the page size in this system?

   b) how many pages would it take to cover the entire virtual  address space?

   c) if you only bought 16MB of physical memory, how many page frames do you have?

   d) if page table entries are 64 bits long, how big of a single-level page table would you require to map all of virtual memory?

Sol:
 a) 2^10 Bytes = 1KB
 b) 2^22 Pages
 c) 16MB / 2^10 = 2^14 (Frames)
 d) 2^22 * 64 = 2^28(bits) = 2^25 (Bytes)



Q3  Suppose we have a demand-paged memory. The page table is held in registers. It takes 8 milliseconds to service a page fault if an empty frame is available or the replaced page is not modified, and 20 milliseconds if the replaced page is modified. Memory access time is 100 nanoseconds.

Assume that the page to replaced is modified 70 percent of the time. What is the maximum acceptable page-fault rate for an effective access time of no more than 200 nanoseconds?

Sol: We know how to find an effective access time (EAT) for a given page-fault rate (p). Here, we have to find 'p' for given 'EAT' so we set up the following equation and solve for 'p':
(Note: 1 millisecond = 1,000,000 nanoseconds = 1e6 nanoseconds)
      EAT = (1-p)*(100) + (p)*(100 + (1-.7)*(8msec) + (.7)*(20msec))  
              = 100 - 100p + 100p + (2.4e6)*p + (14e6)*p
              = 100 + (16.4e6)*p
      200 = 100 + (16.4e6)*p
      p = 100/16.4e6
     

Q4. Consider a program that generates a sequence of virtual address references that correspond to the following sequence of page references:

      1,2,3,4,1,2,5,6,1,3,1,2,7,6,3,2,1,2,3,6

   (i.e., first it references an address in page #1, then an address in page #2, then an address in page #3, etc.)

   show how pages are populated in physical frames over time, and indicate where page faults occur, for each of the following cases:

   a) LRU page replacement, for each subcase of:
       i) one frame, ii) three frames, iii) 5 frames, iv) 7 frames

   b) FIFO page replacement, for each subcase of:
       i) one frame, ii) three frames, iii) 5 frames, iv) 7 frames

   c) Optimal page replacement, for each subcase of:
       i) one frame, ii) three frames, iii) 5 frames, iv) 7 frames


   Did you see an instance of Belady's anomaly? 

Sol: a) 1 frame: (^ indicates a page fault)
    1 2 3 4 1 2 5 6 1 3 1 2 7 6 3 2 1 2 3 6
    ---------------------------------------
    1 2 3 4 1 2 5 6 1 3 1 2 7 6 3 2 1 2 3 6
    ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
    3 frames:
    1 2 3 4 1 2 5 6 1 3 1 2 7 6 3 2 1 2 3 6
    ---------------------------------------
    1 1 1 4 4 4 5 5 5 3   3 7 7 7 2 2     2
       2 2 2 1 1 1 6 6 6   2 2 2 3 3 3     3
          3 3 3 2 2 2 1 1   1 1 6 6 6 1     6
     ^ ^ ^ ^ ^ ^ ^ ^ ^ ^   ^ ^ ^ ^ ^ ^     ^
    5 frames:
    1 2 3 4 1 2 5 6 1 3 1 2 7 6 3 2 1 2 3 6
    ---------------------------------------
    1 1 1 1       1 1    1      1
       2 2 2       2 2    2      2
          3 3       3 6    6      6
             4       4 4    3      3
                      5 5    5      7
      ^ ^ ^ ^     ^ ^    ^       ^
    7 frames:
    1 2 3 4 1 2 5 6 1 3 1 2 7 6 3 2 1 2 3 6
    ---------------------------------------
    1 1 1 1       1 1             1
       2 2 2       2 2             2
          3 3       3 3             3
             4       4 4             4
                      5 5             5
                         6             6
                                        7
    ^ ^ ^ ^       ^ ^             ^
 b) 1 frame:
    Same as a)

    3 frames:
    1 2 3 4 1 2 5 6 1 3 1 2 7 6 3 2 1 2 3 6
    ---------------------------------------
    1 1 1 2 3 4 1 2 5 6   1 3 2 7 6 3     2
       2 2 3 4 1 2 5 6 1   3 2 7 6 3 2     1
          3 4 1 2 5 6 1 3   2 7 6 3 2 1     6
    ^ ^ ^ ^ ^ ^ ^ ^ ^ ^   ^ ^ ^ ^ ^ ^     ^
    5 frames:
    1 2 3 4 1 2 5 6 1 3 1 2 7 6 3 2 1 2 3 6
    ---------------------------------------
    1 1 1 1     1 2 3     4 5   6
       2 2 2     2 3 4     5 6   1
          3 3     3 4 5     6 1   2
             4     4 5 6     1 2   7
                    5 6 1     2 7   3
    ^ ^ ^ ^     ^ ^ ^     ^ ^   ^
    7 frames:
    Same as a)

 c) 1 frame:
    Same as a)

    3 frames:
    1 2 3 4 1 2 5 6 1 3 1 2 7 6 3 2 1 2 3 6
    ---------------------------------------
    1 1 1 1       1 1    1       7 6       1       6
       2 2 2       2 2    2       2 2       2       2
          3 4       5 6    3       3 3       3       3
    ^ ^ ^ ^       ^ ^    ^        ^ ^       ^       ^
    5 frames:
    1 2 3 4 1 2 5 6 1 3 1 2 7 6 3 2 1 2 3 6
    ---------------------------------------
    1 1 1 1      1 1             1
       2 2 2      2 2             2
          3 3      3 3             3
             4      4 6             6
                     5 5             7
    ^ ^ ^ ^      ^ ^             ^
    7 frames:
    Same as a)

 No cases exhibited Belady's anomaly for this sequence of virtual address references.


Q5.  What is the cause of thrashing? How could a system detect thrashing? Once it detects it, what can it do to eliminate the problem?

Sol: In simple words, thrashing is a situation where whenever a process needs to run, it swaps out some other processes working set to disk. This happens when all the processes working set sizes sum to larger then the amount of physical memory available in the system.

Thrashing  can be detected by the system when the CPU utilization starts decreasing and the number of page faults increases considerably.

To eliminate the problem, the system can either decrease the degree of multiprogramming or can use a local  (or priority) replacement algorithm.

Q6.   Give reasons why the page size in a virtual memory system should be neither too large or too small.

As the page size grows, more and more bits are used in the offset field, meaning the size of a page table can shrink.  Also, there are cache size ramifications. This is an advantage of having larger page size. However, as the page size grows, there is more and more fragmentation (since there are going to be more and more pages brought in that are not fully utilized).  It also takes a longer amount of time to bring in a very large page, which can be bad if you are not using much data on that page. This is why smaller page size is preferable.


Q7. (20 points) Consider the two-dimensional array A:

            int A[100][100];

            where A[0][0] is at location 200, in a paged memory system with pages of size 200 bytes. Each int type needs 4 bytes and A is stored in row-major order (as in C/C++). A small process is in page 0 (locations 0 to 199) for manipulating the array; thus, every instruction fetch will be from page 0. For three page frames, how many page faults are generated by the following array-initialization loops, using LRU replacement, and assuming frame 0 has the process in it and the other two frames are initially empty?

Sol:In this system, each page holds 50 integers and thus one row of A needs 2 pages and entire A needs 2 *100 = 200 pages.

(a)    for (int I=0; I< 100; I++)
for (int J=0; J < 100; J++)
    A[I][J]=0;

In this case, the array A is accessed row by row and thus each row generates 2 page faults as the first reference to a page always generates a page fault. Using LRU, it will generate 200 page faults.

 (b)   for (int I=0; I< 100; I++)
for (int J=0; J < 100; J++)
    A[J][I]=0;

In this case, the array A is accessed column by column and thus the process references 100 pages in each outside loop (I), which is the working set of the program. But we only have 2 frames, and thus each array reference will generate a page fault. Using LRU, it will generate 100 * 100 = 10,000 page faults.

This example shows that a well-written program can be much faster than a program is not carefully written.

Q8. A virtual memory system has a page size of 1024 words, eight virtual pages, and four physical page frames. The page table is as follows:

Virtual page Number  Page Frame Number

        0                        1
        1                        0
        2                        3
        3                        -
        4                        -
        5                        2
        6                        -
        7                        -
            

            a. What is the size of the virtual address space? (How many bits in a virtual address?)

                        13 bits

            b. What is the size of the physical address space? (How many bits in a physical address?)

                        12 bits

            c. What are the physical addresses corresponding to the following decimal virtual addresses: 0, 3728, 1023, 1024, 1025, 7800, 4096?

To solve this problem, you will have to first find the Virtual page number corresponding to the Virutal address, then find the corresponding  frame number from table given above and add the offset value to find out the actual physical address. If the Virtual page is not mapped to any physical frame number, this indicates a page fault.

                        0       000 00 0000 0000        01 00 0000 0000   
                        3728    011 10 1001 0000        Page Fault
                        1023    000 11 1111 1111        01 11 1111 1111
                        1024    001 00 0000 0000        00 00 0000 0000
                        1025    001 00 0000 0001        00 00 0000 0001
                        7800    111 10 0111 1000        Page Fault
                        4096    100 00 0000 0000        Page Fault


Tuesday, December 10, 2019

Legit Cashback Websites

These are the cashback website that I used for getting cashback. And so far they seem legit.

1. Rakuten

Sign up to Rakuten cashback with this link and get 25 dollars bonus after you made 30 dollars in purchase.

 
https://www.rakuten.com/r/MLOVEA12?eeid=28187

 

2. Ubucks
https://www.ubucks.com/u/2TAN93


3. BeFrugal
https://www.befrugal.com/rs/PFICASN/
BeFrugal.com Cash Back

4. TopCashBack
Here is the referal link for sign up bonus coupon:
https://www.topcashback.com/ref/savemightlife

5. Upromise

Upromise helps you save for college. You can earn $5.29 now by signing up and another $25 when you link a 529 plan.* Take a look!
* Bonus is awarded as $5.29 for email verification and $25.00 for account linking. Member must link a 529 College Savings Plan account within 30 days of Upromise sign-up and keep it active through the first cash back rewards redemption cycle to receive the $25.00 bonus. Member's cash back rewards account balance must meet the minimum transfer amount to be eligible for transferring cash back rewards into a linked 529 account.

https://www.upromise.com?rb=87136458
 

 

 6. Hoopla Doopla

Hoopla Doopla has been a trusted Cash Back partner for over a decade, since its founding in 2009. 

https://hoopladoopla.com?ref=R3NLjMzklJ1Gb2P5KOKkYnOqx4wdQprey07DBZgE

 

These are some legit cashback apps:

1. Ritual
Sign Up here to get 10 dollars free
Image result for ritual appsRelated imageRelated image


2. Fetch Rewards
Check out Fetch Rewards. Turn any grocery receipt into savings! Use my referral code, TYHAR, during signup and you'll get 2,000 Fetch Points just for starting.
Download here: https://fetchrewards.onelink.me/vvv3/referralsocial?code=TYHAR

Sunday, December 1, 2019

Fundamentals of Networking Basic Questions and Answers

Fundamentals of Networking
Basic Questions and Answers

a)  Name the five layers in the Internet Protocol Stack.
Application
Transport
Network
Data Link
Physical

b)  Give two reasons why the Internet primarily uses packet switching instead of circuit switching.
Statistical multiplexing for busty traffic; No setup latency; No state; Simple; Robustness in the face of failure

c)  Considering a small network of four hosts and three links as depicted in the figure below. A 1,000,000 bits message is to be sent from A to D. The bandwidth of the first two links is 400,000 bps, but the link between C and D is 1,600,000 bps. Propagation delays of the links are negligible. Assume that circuit switching is used and the total circuit setup time is 100 ms, what is the time to send the message from A to D?
A → B→ C→ D
The overall circuit bandwidth is bounded by the slowest link which is 400,000 bps. Thus the time to send the message is the sum of the setup time (100ms) and the transmission time (1,000,000/400,000 = 2500 ms), which is 2600ms.


d)   Repeat part c by assuming that packet switching is used with packet size 10,000 bits plus header size of 160 bits, store-and-forward routers at B and C, as well as negligible queuing delays.
Number of packets = 1,000,000 / 10,000 = 100 packets
Size of each packets = 10,160 bits
Transmission time for the first packet
= transmission time from A to B + transmission time from B to C + transmission time from C to D
= 10160/400000 + 10160/400000 + 10160/1600000 = 57.15 ms
For the remaining 99 packets, the transmission time is dominated by the slowest link which operates at 400000 bits/second = 99 * 10160/400000 = 2514.6 ms
Total time = 2514.6 + 57.15 = 2571.75 ms

2) Application Layer
a)  Answer True or False to the following statements:
i) To get a Web page with some text and three images, a browser needs to send 1 request message and receives 4 response messages. FALSE
ii) Two pages (e.g. www.uky.edu/research.html and www.uky.edu/index.html) can be sent over the same persistent connection. TRUE
iii) With non-persistent connections, it is possible for a single TCP segment to carry two distinct HTTP request messages. FALSE
iv) HTTP response messages never have an empty message body. FALSE
v) One reason for having a proxy server is to provide caching. TRUE

b) Consider distributing a file of 10 Gbits to 100 peers in a P2P network. The server has an upload rate of 20 Mbps, and each peer has a download rate of 1 Mbps and an upload rate of 200 Kbps. Find the minimum distribution time.
To calculate the minimum distribution time in a P2P network, we can use the formula
DP2P = max{F/us, F/dmin, NF/(us+Σiui )}
where F = 10Gbits = 10,000 Mbits, us = 20 Mbps, dmin = 1 Mbps and ui = 0.2 Mbps for all i. F/us = 500s, F/dmin = 10,000 s and the last term is 25,000 s. So the last term dominates and the minimum distribution is 25,000s.
c) (10 points) Describe the steps a server takes in a typical network program with stream sockets. The first step has been filled in for you.
i) Create a socket
ii) Bind the socket to a well known port
iii) Listen to the socket for connections
iv) Accept the connection and create a temporary socket
v) Send and receive data from the client
vi) Close the temporary socket

3) Transport Layer
a) (5 points) What are the functions of port numbers in the TCP header? Why does TCP header include both source port number and destination port number?
They are multiplexing and de-multiplexing at the host. A TCP server needs both the source and destination port numbers in order to correctly identify the socket when communicating multiple clients.
b) (5 points) Assume that each bit position has at most one error. Identify the error bit locations in the following scenario:
data0: 1110 0110 0110 0100
data1: 1101 1101 0101 0101
checksum: 0100 0100 0000 0011
sum: 100000 0111 1011 1100
carry: 10
and then wraparound: 0000 0111 1011 1110
error bit positions: **** * * *
c) (10 points) A sliding window protocol is used in a transmission. The sender wants to send 10 packets with a rate 1 packet/ms. The propagation delay is 2 ms for any packet, and the time out is 8 ms. Assume Go-Back-N is used, window size is 5 packets and the packet #4 is lost. Fill up the below picture with information about sending packet from sender to receiver and ACK packet in the reverse direction.
Sender
Receiver
1 ms
2
3
4
5
6
7
8
4
5
6
7
8
9
10
Time out is 8 ms
1
\
4) (Outcome 3, 20 points) Transport Layer:TCP
The following graph shows the variation of the size of the congestion window (interpolated) of a TCP sender over time. MSS stands for Maximum Segment Size. Use this graph to answer the following questions.
a) (5 points) At time t0, what is the event that triggers the reduction of the window size by half?
The sender receives three duplicate ACK packets which indicate possible congestion. In response, it reduces the sending rate by halving the sending rate.
b) (5 points) At what rate is the congestion growing between time t0 and t1?
The congestion window grows by 1 MSS for every ACK the sender receives. The
slower increase is to slowly approach the equilibrium (fair) sending rate.
c) (5 points) At time t1, the window size drops to 1 MSS and stays there due time t2. What are the events that trigger the changes in window size in both time t1 and t2?
At time t1, there is a timeout event which is considered to be more serious than three duplicate ACKs. Thus, the sender drastically reduces the window size to 1 MSS rather than merely halving it. No new ACK packet is received until time t1 which then allows the congestion window to increase again.
d) (5 points) What happen at time t3?
To prevent an overshoot of sending rate, the sender changes from slow start to linear increase when the window size reaches half of the window size before the loss event.