Your mission is to transform a sequential stack implementation into a wait-free, linear iz able stack implementation, without regard for questions of efficiency or memory use. You are given a “black-box” Sequence type with the following methods: You can atomically append an item to the end of the sequence. For example, if the sequenceis〈1,2,3〉, and you append 4, the sequence becomes〈1,2,3,4〉. This operation is wait-free and linear iz able: if a concurrent thread tries to append 5, the sequence be-comes either〈1,2,3,4,5〉.or〈1,2,3,5,4〉. Note that Sequence items do not have to be integers: they can be any kind of object you like. You can also iterate through the elements of a sequence. Here, we iterate through a sequence printing each value until we see the string" stop"
(Note that if another thread is appending new values while you are iterating through a sequence, you might keep going forever.)Implement a wait-free linear iz able stack using an atomic sequence object, and as much atomic read–write memory and sequential stack objects as you like. Your stack should support both push() and pop()operations with the usual meanings. Again, do not worry about efficiency or memory use. Explain briefly why your construction is wait-free and linear iz able (in particular, identify the linearization points).