JJJJJJ
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # NTUEE Queueing Theory 2022 FALL HW1 ## 1 Suppose you are given Poisson processes from source-1 and source-2, with arrival rate $\lambda_1$ and $\lambda_2$ respectively. And there is no arrival at the starting time $t=0$. 1. Please show that the inter-arrival time afer the aggregation of these Poisson processes is exponential with mean equal to $\frac{1}{\lambda_1 + \lambda_2}$. (10%) :::spoiler Answer Let $T_1$ denote the inter-arrival time for the Poisson process from source 1, $T_2$ for that from source 2, and $T$ for the aggregated Poisson process of the three. Obviously, $T = min(T_1, T_2)$, and we are interested in the probability distribution of $T$ and $E(T)$, and we know that the arrival from source-1 and the arrival from source-2 are independent of each other. $$\begin{split} P(T > t) &= P(min(T_1, T_2) \gt t) \\ &= P(T_1 \gt t \cap T_2 \gt t) \\ &= P(T_1 \gt t) \cdot P(T_2 \gt t) \\ &= e^{-\lambda_1 t} \cdot e^{-\lambda_2 t}\\ &= e^{-(\lambda_1+\lambda_2) t} \end{split}$$ So $T$ is a exponential random variable with parameter $\lambda_1 + \lambda_2$, thus the mean of $T = E[T]$ is $\frac{1}{\lambda_1 + \lambda_2}$. ::: 2. Please derive the probability that the first arrival is from source-1 and the second arrival is from source-2, if the observation starts from $t = 0$. (5%) :::spoiler Answer There are two ways to solve this question: First, let $T_1$ denote the time for the first arrival from source-1, and $T_2$ for that of source-2, since arrivals from source-1 & source-2 are independent of each other, their joint probability density function is $$f_{T_1, T_2}(t_1, t_2) = \lambda_1 e^{-\lambda_1 t_1} \cdot \lambda_2 e^{-\lambda_2 t_2}$$ So, the probability that the first arrival is from source-1 is $$\begin{aligned} Pr(T_1 \lt T_2) &= \int_0^{\infty}\int_{t_1}^{\infty} \lambda_1 e^{-\lambda_1 t_1} \cdot \lambda_2 e^{-\lambda_2 t_2} dt_2dt_1 \newline &= \int_0^{\infty}\lambda_1 e^{-\lambda_1 t_1} (-e^{-\lambda_2 t_2})\bigg\rvert_{t_1}^{\infty} dt_1 \newline &= \int_0^{\infty}\lambda_1 e^{-\lambda_1 t_1} (e^{-\lambda_2 t_1}) dt_1 \newline &= \lambda_1 \int_0^{\infty} e^{-(\lambda_1 + \lambda_2) t_1} dt_1 \newline &= \frac{\lambda_1}{\lambda_1 + \lambda_2} \end{aligned}$$ Similarly, the probability that the second arrival is from source-2 is $$Pr(T_2 \lt T_1) = \frac{\lambda_2}{\lambda_1 + \lambda_2}$$ So the desired probability that the first arrival is from source-1 and the second arrival is from source-2 is $$\frac{\lambda_1}{\lambda_1 + \lambda_2} \cdot \frac{\lambda_2}{\lambda_1 + \lambda_2} = \frac{\lambda_1\lambda_2}{(\lambda_1 + \lambda_2)^2}$$ The second solution to this problem based on the fact that we know that the probability of $k$ arrivals for a Poisson process with arrival rate $\lambda$ during time period of $[t, t+\tau]$ being $\frac{e^{-\lambda \tau}(\lambda \tau)^k}{k!}$. We use $Pr_n(k)$ to denote that there are $k$ arrivals from source $n$ in time period of $[0, T]$. Thus, the desired probability can be expressed as: $$\begin{aligned} P &= \frac{\frac{1}{2}Pr_1(1)\cdot Pr_2(1)}{Pr_{1||2}(2)} \newline &= \frac{\frac{1}{2}\frac{e^{-\lambda_1 T}(\lambda_1 T)}{1!} \cdot \frac{e^{-\lambda_2 T}(\lambda_2 T)}{1!}}{\frac{e^{-(\lambda_1+\lambda_2) T}((\lambda_1+\lambda_2) T)^2}{2!}} \newline &= \frac{\lambda_1 \lambda_2}{(\lambda_1+\lambda_2)^2} \end{aligned}$$ One can verify this by summing up all possible conditional probabilities((source of frist arrival, source of second arrival) can be (1, 1), (1, 2), (2, 1), (2, 2)): $$\frac{\lambda_1^2}{(\lambda_1+\lambda_2)^2} + \frac{\lambda_1 \lambda_2}{(\lambda_1+\lambda_2)^2} + \frac{\lambda_2 \lambda_1}{(\lambda_1+\lambda_2)^2} + \frac{\lambda_2^2}{(\lambda_1+\lambda_2)^2} = 1$$ ::: 3. Please derive the probability that there is no arrival from these two sources during time interval $(a,b)$, where $a < b$. (5%) :::spoiler Answer By the memoryless property, the desired probability $P$ there is no arrival from these two sources during time interval $(a,b)$ is the same as that of time interval $(0, b-a)$, and same as 2., we know that the probability of $k$ arrivals for a Poisson process with arrival rate $\lambda$ during time period of $[t, t+\tau]$ is $$\frac{e^{-\lambda \tau}(\lambda \tau)^k}{k!}$$ So $P$ has the following form: $$\begin{aligned} P &= \frac{e^{-(\lambda_1 + \lambda_2)(b-a)}((\lambda_1 + \lambda_2)(b-a))^0}{0!} \newline &= e^{-(\lambda_1 + \lambda_2)(b-a)}\end{aligned}$$ 4. If you randomly select time epoch $t_0$ in the future to observe these 2 arrival processes, what is the expected length of the interval between the nearest arival(from any source) before $t_0$ and the first arrival(from any source) after $t_0$? (10%) :::spoiler Answer The short answer is by memoryless property, the expected length is $2 \cdot \frac{1}{\lambda_1 + \lambda_2} = \frac{2}{\lambda_1 + \lambda_2}$. But a explanation of why $\frac{2}{\lambda_1 + \lambda_2} \neq \frac{1}{\lambda_1 + \lambda_2}$ will be needed **if specified is the Midterm quiz**. The explanation follows the same process in [note of Forward Recurrence Time & Backward Recurrence Time in Poisson Process](https://hackmd.io/5a0BMBLqTdaOrjxfoeqdEg#Forward-Recurrence-Time-amp-Backward-Recurrence-Time-in-Poisson-Process), we can show that the expected length is $\frac{2}{\lambda_1 + \lambda_2}$. ::: ## 2 Consider an $M/M/1/2$ queue with arrival rate $\lambda$ and service rate $\mu = \lambda$. 1. Please write down the generator matrix Q for its continuous time Markov Chain, which represents its system size(the number of customers in the system). (5%) :::spoiler Answer $Q = \begin{pmatrix} -\lambda & \lambda & 0\\ \mu & -(\lambda+\mu) & \lambda\\ 0 & \mu & -\mu\\ \end{pmatrix}$ ::: 2. Please then solve its steady-state probability $p_n$ for $n=0,1,2$ using the generator matrix obtained in 1 and the equation $PQ = 0$, and $Pe=1$.(10%) :::spoiler Answer let $P = (p_0, p_1, p_2), e = (1,1,1)$ solve: $$\begin{cases} PQ = 0 \\ Pe = 1 \end{cases} \Longrightarrow \begin{cases} p_1 = \frac{\lambda}{\mu} \cdot p_0 \\ p_2 = (\frac{\lambda}{\mu})^2 \cdot p_0 \\ p_0 = (1 + \frac{\lambda}{\mu} + (\frac{\lambda}{\mu})^2)^{-1} \end{cases}$$ ::: 3. Please determine the mean holding time(mean state sojourn time) for state 0,1,2. (5%) :::spoiler Answer let $m_i$ denote the mean holding time(mean state sojourn time) for state $i$. $$\begin{cases} m_0 = \frac{1}{-q_{00}} = \frac{1}{\lambda} \newline m_1 = \frac{1}{-q_{11}} = \frac{1}{\lambda + \mu} \newline m_2 = \frac{1}{-q_{22}} = \frac{1}{\mu} \end{cases}$$ ::: ## 3 Suppose there is an $M/M/1/2$ queue with blocking probability $P_b$, and $\lambda = 2, \mu = 3$. 1. Please calculate the average system size $L$ using $p_n$, and then derive average waiting time $W$ using Little's formula. (5%) :::spoiler Answer from 2. we know $p_n$ has the following form: $$\begin{cases} p_1 = \frac{\lambda}{\mu} \cdot p_0 = \frac{6}{19}\\ p_2 = (\frac{\lambda}{\mu})^2 \cdot p_0 = \frac{4}{19}\\ p_0 = (1 + \frac{\lambda}{\mu} + (\frac{\lambda}{\mu})^2)^{-1} = \frac{9}{19} \end{cases}$$ $L$ can be calculated as: $$\begin{aligned} L &= E[N] = \sum_{i=0}^2 np_n \newline &= 0p_0 + 1p_1 + 2p_2 \newline &= \frac{6}{19} + 2\frac{4}{19} \newline &= \frac{14}{19} \end{aligned}$$ The effective arrival rate is: $$\lambda_{eff} = \lambda(1 - p_2) = \frac{30}{19}$$ Using Little's formula: $$\begin{aligned} W = \frac{L}{\lambda_{eff}} = \frac{7}{15} \end{aligned}$$ ::: 2. Please show that $P_b = p_2$. (5%) :::spoiler Answer Since the queue's capcity is $2$, so queue blocks customer from entering when the queue size is $2$, thus $P_b = p_2$. ::: 3. Please show that the effective arrival rate (the rate that customers are admitted in this queue) is given by $\lambda_{eff} = \lambda(1 - P_b)$. (5%) :::spoiler Answer Since $(1 - P_b)$ is the probability that customers will not be blocked by queue, which is to say, customers can enter the queue with probability $(1 - P_b)$, thus, the effective arrival rate $\lambda_{eff}$ is $\lambda(1 - P_b)$. ::: 4. Please calculate this queue's utilization, and the probability that it is idle. (5%) :::spoiler Answer The queue is idle when there is no customer in the queue, so the probability that this queue is idle is: $$p_0 = \frac{9}{19}$$ Since the queue is either idle or being in use, so the queue's utilization is $$U = 1 - p_0 = \frac{10}{19}$$ The queue's utilization can also be calculated as: $$U = \frac{\lambda_{eff}}{\mu} = \frac{10}{19}$$ ::: 5. Please verify your results in 1., 2., 4. and using JMT simulator, and attach your simulation results (i.e. the obtained figures). (20%, 5% for each result in 1., 2., 4.) :::spoiler Answer Model Structure: ![](https://i.imgur.com/2pMw1DB.png) $L$ corresponds to **Number of Customers**, $$L = \frac{14}{19} \approx 0.736842$$ ![](https://i.imgur.com/rXwKWuJ.png) $W$ corresponds to **Response Time**, $$W = \frac{7}{15} \approx 0.466$$ ![](https://i.imgur.com/H0umkl8.png) $U$ corresponds to **Utilization**, $$U = 1 - p_0 = \frac{10}{19} = \approx 0.5263157$$ ![](https://i.imgur.com/k5LmOuq.png) $\lambda P_b$ corresponds to **Drop Rate**, $$\lambda P_b = \lambda p_2 = 2\frac{4}{19} = \approx 0.42105$$ ![](https://i.imgur.com/sHKdwc8.png) ::: ## 4 Now Consider the same $M/M/1/2$ queue in 3. 1. If we set $\lambda = 4, \mu = 3$, why we can still obtain its steady state prob.distribution even though $\lambda > \mu$ ? (5%) :::spoiler Answer from 3., we know that the queue's utilization is $$U = \frac{\lambda_{eff}}{\mu} = \frac{10}{19} < 1$$ Since utilization is less than $1$, the queue can stay stable, thus has state prob.distribution. ::: 2. If we set $\lambda$ to be very large, what is the mean inter-departure time for this queue? (5%) :::spoiler Answer There are always customers in the queue being served when $lambda$ is very large, which is to say, the server is always busy, so the inter-departure time is equal to the mean service time $\frac{1}{\mu} = \frac{1}{3}$. :::

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully