A stronger form of pseudo-compactness. A topological space $X$ is called pseudo-compact if every continuous real-valued function from $X$ is bounded. In general, the notion of pseudo-compactness is not equivalent to compactness, although it is for metric spaces.
Now, clearly, if $X$ is a compact space then every continuous real-valued function $f$ from $X$ attains its maximum, i.e. there exists $x \in X$ such that for all $z \in X$ we have $f(x) \geq f(z)$. This is because the image of compact spaces under continuous maps is compact and therefore $f(X) \subseteq \mathbb{R}$ (as a bounded and closed set) contains its supremum.
Question: Let $X$ be a topological space such that every continuous real-valued function attains its maximum. Must $X$ be a compact space?
My guess would be that there exists a counterexample, but I was not able to construct one.
Thank you in advance for your help!
 A: Your condition is actually not any stronger than pseudocompactness.  Indeed, suppose $X$ is pseudocompact and $f:X\to\mathbb{R}$ does not attain a maximum.  Let $M$ be the supremum of the image of $f$ and let $g(x)=\frac{1}{M-f(x)}$.  Then $g:X\to\mathbb{R}$ is continuous and unbounded, which is a contradiction.
A: No, take $\omega_1=\{\alpha:\alpha<\omega_1\}$ with its order (open-interval topology). (I will add a bit more later, but it is well-know that the one-point compactification of $\omega_1$ is the same as its Stone-Cech compactification, because every continuous real-valued function on $\omega_1$ is constant on a tail. There may also be some regular, non-completely regular examples, where real-valued functions are constant, but I need to search to provide a reference.) 
Here is a link to an example by Mysior of a regular space that is not completely regular, A. Mysior, A regular space which is not completely regular, Proc. Amer. Math. Soc. 81 (1981), pp.652-653, https://www.ams.org/journals/proc/1981-081-04/S0002-9939-1981-0601748-4/S0002-9939-1981-0601748-4.pdf
It also indicated how to construct a regular space in which every real-valued function is constant. (And of course, it cannot be compact, since if it were, then it would be normal, which it is not.) 
There seem to be some newer related work: On regular but not completely regular spaces, Piotr Kalemba, Szymon Plewik, https://arxiv.org/abs/1701.04322 
The result that every continuous real-valued function on $\omega_1$ is eventually constant should be available in many topology books, I know it is in Willard's General topology, ought to be (in some form) in Engelking's General topology, and perhaps it is in Munkres too, don't know. It is also mentioned at wikipedia https://en.wikipedia.org/wiki/Order_topology#Topology_and_ordinals 
https://en.wikipedia.org/wiki/Order_topology#Topology_and_ordinals
A: If $X$ is pseudocompact and $f: X \to \Bbb R$ is continuous, it is well-known (and easy to prove) that $f[X]$ is also pseudocompact (in the subspace topology) and for metric spaces pseudocompactness and compactness are equivalent. So $f[X]$ is compact and so is bounded and contains its maximum and minimum. 
So your proposed property is exactly equivalent to being pseudocompact. 
