Skip to content

priority == preemptible doesn't preempt #53

Closed
@nacnudus

Description

@nacnudus

From ?seize:

preemptible: if the seize occurs in a preemptive resource, this parameter
establishes the minimum incoming priority that can preempt this
arrival (a seize with a priority equal to preemptible or more
gains the resource; by default, any seize may cause preemption
in a preemptive resource).

In which case I would expect the first block of code below to have the same result as the second. Have I misunderstood? I would prefer the documented behaviour, since it allows implementation of LIFO servers without needing to assign priorities.

  t0 <- create_trajectory() %>%
    seize("dummy", 1, priority = 0, preemptible = 0) %>%
    timeout(10) %>%
    release("dummy", 1)
  env <- simmer() %>%
    add_generator("p0p0:", t0, at(0, 1)) %>%
    add_resource("dummy", 1, preemptive=TRUE, preempt_order="lifo") %>%
    run()
  arrs <- env %>% get_mon_arrivals()
  arrs_ordered <- arrs[order(arrs$name),]
  arrs_ordered
#>     name start_time end_time activity_time finished replication
#> 1 p0p0:0          0       10            10     TRUE           1
#> 2 p0p0:1          1       20            10     TRUE           1
  t0 <- create_trajectory() %>%
    seize("dummy", 1, priority = 1, preemptible = 0) %>%
    timeout(10) %>%
    release("dummy", 1)
  env <- simmer() %>%
    add_generator("p1p0:", t0, at(0, 1)) %>%
    add_resource("dummy", 1, preemptive=TRUE, preempt_order="lifo") %>%
    run()
  arrs <- env %>% get_mon_arrivals()
  arrs_ordered <- arrs[order(arrs$name),]
  arrs_ordered 
#>     name start_time end_time activity_time finished replication
#> 2 p1p0:0          0       20            10     TRUE           1
#> 1 p1p0:1          1       11            10     TRUE           1

Just nitpicking really -- this is a marvellous package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions